Using the SharePoint 2010 Organization Browser web part on a different web application and specifying a user.
The SilverLight based Organizational Browser web part is a standard feature of SharePoint 2010 and is particularly useful if you wish to display your organisation chart on an Intranet page for example. However, if you add this web part to a different web application that the Mysite host and your environment is patched below SP1 then it displays without content. It also takes the current user as a starting point and not a specific user such as the CEO.
Making the Organization Browser work in a web application other than MySite host
This is only required if you are not yet running SharePoint 2010 SP1 or later and are trying to add the Organisation Browser to a page which resides in a web application than does not house your MySite host. In this instance it will appear blank, a problem that is caused by SilverLight security and the lack of a cross domain policy. To over come this, a crossdomain.xml file needs to be placed in the root of the web application where your MySite host resides.
A basic CrossDomain.xml file:
<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd"> <cross-domain-policy> <allow-access-from domain="*" /> <allow-http-request-headers-from domain="*" headers="*"/> </cross-domain-policy>
This is a very liberal cross domain policy, in a production environment I recommend you limit the domain setting to suit your environment.
Copy the content above and save it locally as crossdomain.xml and then launch SharePoint Designer. In SharePoint designer open the root site which hosts your MySite host and select All Files from the left hand navigation. Click Import Files from the ribbon and add the CrossDomain.xml file you saved earlier. The end result should look like this.
In a browser test that you can access this file http://<mysitehost web application>/CrossDomain.xml, next test a page which contains the Organization Browser hosted on another web application, this should now render correctly in the SilverLight view. The focus will be set to the current user, so unless you are the CEO, there is still a little bit of work to do.
Setting the initial focus of the Organisation Browser to a specific user.
So now you have a page containing the web part but you want to set the initial focus to the CEO or a department head, this is exactly how the web part works in the users profile when you click on Organization. This is controlled by a query string parameter containing the account name that looks like this accountname=domain%5Cian%2Eankers. You will need to add this parameter for the user you wish to set the focus too to the links that reference your new page, for example OrgChart.aspx?accountname=domain%5Cian%2Eankers
However before this is going to work, the file hosting the web part needs to be edited in Advanced Mode using SharePoint Designer. Open the page in Code view and under the last <%@ Register tag, add this line.
<%@ Register Tagprefix=”SPSWC” Namespace=”Microsoft.SharePoint.Portal.WebControls” Assembly=”Microsoft.SharePoint.Portal, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c” %>
Next search for this line: <asp:Content ContentPlaceholderID=”PlaceHolderMain” runat=”server”> and directly beneath it, add the following.
<SPSWC:ProfilePropertyLoader runat=”server” />
Now save the file and you should now have the Organization Browser running in a separate web application and with the focus set to the user specified in the accountname query string parameter.
SharePoint 2010 Mysite editprofile.aspx and HTTP 403 error
On a SharePoint 2010 environment which is not yet live, I noticed users were receiving a HTTP 403 error when attempting to edit their own profile, however all other Mysite functionality was fine and this affected all three web front-ends.
The farm account was able to access EDITPROFILE.ASPX and subsequently this allowed users to edit their profiles on the server which the farm account had accessed, other servers would still report a 403. The ULS had an access denied error but no other useful information, however this looked like a caching problem. Sure enough, the SuperUser cache accounts had been set recently and after checking in Web Application policies, these accounts had been given permissions to all web applications with the exception of the MySite Host.
Adding these accounts to web policies for the Mysite web application enabled users to edit their profiles again.
Customizing the MySite What’s New webpart
The My Newsfeed page of Mysites lists activities of a users colleagues in a newsfeed. As this takes up only a small amount of horizontal screen space so well suited to hosting other web parts such as upcoming birthdays or twitter feeds.
However, the webpart does host other links which point to edit My Interests and News feed settings, however these are just bookmarks within the /_layouts/EditProfile.aspx page and really rather pointless and I wanted to remove them.
Out of the box, there is no option to customize the What’s New web part but I wanted to remove these additional links and move it to the Middle Left Web Part Zone so the only option was to resort to JavaScript. To implement, edit the page, add a Content Editor Web Part and add the following script in the HTML view to set the InnetText to nothing. Change the [YOUR MYSITE HOST] value in the links first of course.
<script type="text/javascript"> var rs=document.getElementsByTagName ('a'); for(var i=0;i<rs.length ;i++){ var s=rs[i].href; if(s.indexOf('http://[YOUR MYSITE HOST]/_layouts/EditProfile.aspx?Interests')!=-1){ rs[i].innerText=""; } if(s.indexOf('http://[YOUR MYSITE HOST]/_layouts/EditProfile.aspx?NewsFeedPreferences')!=-1){ rs[i].innerText=""; } } </script>
Remove warning icon ‘Indicates a field that is updated automatically from the corporate directory. Changes to these properties may be lost’
In an organisation where I’m deploying SharePoint 2010, the user profile service will be used to populate data back to Active Directory via self service. The properties are set as editable and export rules are in place. However the edit user profile page still shows – “Indicates a field that is updated automatically from the corporate directory. Changes to these properties may be lost” at the top of the page and warning triangles against some fields that are being exported.
The page logic seems broken and doesn’t recognise all fields have a mapping, but the ones it does it seems to presume they are import rules and not export so displays the warning.
To remove the warnings I was forced to amend editprofile.aspx from 14/TEMPLATE/LAYOUTS, taking a backup first of course. To do this, open the file, find the line:
<SPSWC:ProfileEditor id=”ProfileEditor” runat=”server” />
Now and add the attribute, ShowWarningIcon=”False” so it becomes:
<SPSWC:ProfileEditor id=”ProfileEditor” ShowWarningIcon=”False” runat=”server” />
Open the edit profiles page and no more warning icons, however this also messes up the formatting of the page which can be fixed via following this post. If anyone knows a better way without modifying out of the box pages, I’d be happy to hear it.
There was an error saving the picture. Please try again later.
Since applying SharePoint 2010 SP1 and the June 2011 cumulative update, users with the Manage User Profile permission are unable to add photos for other users via the web interface, attempting to do so results in the message “There was an error saving the picture. Please try again later.” . However users can upload their own photos.
This occurs on three separate environments which were working correctly before the updates were applied, this is also affecting others, see here and here.
Furthermore, there is nothing the eventlogs or ULS, as a workaround I have been using this script from Phil Childs
UPDATE 3
This issue was NOT fixed in the October 2011 update.
UPDATE 2
This issue was NOT fixed in the August 2011 update.
UPDATE
Trevor Seward did some digging and compared the code from Pre and Post June CU and as you can see from his post, MS made a schoolboy error in the SaveFileToPersonalSite method in Microsoft.SharePoint.Portal.WebControls.ProfileImagePicker.
Recent Posts
- Updated – Approve or Reject multiple items in a SharePoint 2010 list
- Site Navigation with a Content Query Web Part in a SharePoint Page Layout
- SharePoint, JQuery and z:row when using Chrome
- This page is not using a valid page layout in SharePoint 2010
- Create a blank publishing page in SharePoint 2010 for a print view or hosting in an iFrame