At first: This is a common problem. Using the "Organization Browser" Web Part on another page than on the MySite host web application results in an empty view. This means, the "Organization Browser" does not have any content. – As I said: This is a common problem.
First step to fix this is to create a “clientaccesspolicy.xml” file in the IIS directories of the SharePoint Web Applications.
See this blog post of Adam Preston:
http://www.tcscblog.com/2011/04/11/using-the-sharepoint-2010-organization-browser-in-another-web-application/
BUT:
In my current case it remains empty!!!
I used Fiddler to analyse the problem.
The Silverlight App “Organization Browser” executes a Web Service request but the response is empty. Not like an error but the Web Service does not find any data for the given account. Please see this screenshot for the request and its response:
I modified the request in Fiddler and removed the claim info “i:0#.w|” in the request. – And now it works. The Web Service does respond correct data!!!
I checked the authentication mode of both sites:
The MySite Web Application uses “Classic Authentication” and the Web Application from within I call the Organization Browser App is “Claims Based Authentication”. This results in bad request data for the Web Service. The “Claims Based” Web Application sends the user name in “claim format” but the MySite Web App cannot handle it. So I have to migrate the MySite Web App to Claims Based Authentication.
For the Migration of the MySite Web App from Classic Authentication to Claims Based Authentication I’ve written this script:
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
######################################################################################################
$url = "http://personal.sharepoint.local"
$webapp = Get-SPWebApplication $url -ErrorAction SilentlyContinue
if( $webapp -ne $null) {
Write-Host "Web Application: $($webapp.Url)"
Write-Host " Active Claim Based Authentication"
$webapp.UseClaimsAuthentication = "TRUE"
Write-Host " Update Web Application"
$webapp.Update()
Write-Host " Provisioning Web Application"
$webapp.ProvisionGlobally()
#Claims Migration
Write-Host " Set Authentication Provider"
$webapp = Get-SPWebApplication $url -ErrorAction SilentlyContinue
Set-SPwebApplication $webapp -AuthenticationProvider (New-SPAuthenticationProvider) -Zone Default
Write-Host " Migrate Users to Claim Based Authentication"
$webapp = Get-SPWebApplication $url -ErrorAction SilentlyContinue
$webapp.MigrateUsers($true)
}
After that I realized that the personal site collection does not have correct Site Collection Admin settings any more: There the original “Classic Mode” users are registered not the “Claim” user (login) names.
I’ve written this script to fix this:
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
######################################################################################################
$url = "http://personal.sharepoint.local"
$webapp = Get-SPWebApplication $url -ErrorAction SilentlyContinue
if( $webapp -ne $null) {
$sites = Get-SPSite -Limit all
$sites | % {
$site = $_
if( $site.Url.StartsWith("http://personal.sharepoint.local/sites/domain_", [System.StringComparison]::InvariantCultureIgnoreCase) ){
Write-Host "$($_.Url)" -ForegroundColor Green
$site.RootWeb.SiteUsers | ? { $_.IsSiteAdmin } | % {
$user = $site.RootWeb.EnsureUser("i:0#.w|" + $_.LoginName)
$user.IsSiteAdmin = $true
$user.update()
}
} else {
Write-Host "$($_.Url)" -ForegroundColor Red
}
}
}
BUT: It does not work eighter !!!
It seems to be a known limitation of the Organization Browser not to work at “Claims Authentication” enabled Web Applications.
BUT: I could create a wolkaround for this!!!
You need to edit the page where you want to use the “Organization Browser” in SharePoint Designer 2010 in Advanced Mode. – In my case I created a new Page Layout for my page derrived from the Page Layout “Welcome Links – Table Of Content”. In this case I modified this custom Page Layout.
This is the JavaScript code including the Content Placeholder ASP.NET tag for the code:
<asp:Content ContentPlaceHolderID="PlaceHolderUtilityContent" runat="server">
<script type="text/javascript">
var oldCreateHierarchyChartControl = CreateHierarchyChartControl;
function CreateHierarchyChartControl(parentId, profileId, type) {
var i = profileId.indexOf("|");
//alert(i);
if(i >=0 )
profileId = profileId.substr(i+1,profileId.length-i-1);
//alert(profileId);
var initParam = profileId + ',' + type;
var host = document.getElementById(parentId);
host.setAttribute('width', '100%');
host.setAttribute('height', '100%');
Silverlight.createObject('/_layouts/ClientBin/hierarchychart.xap',
host,
'ProfileBrowserSilverlightControl',
{
top: '30',
width: '100%',
height: '100%',
version: '2.0',
isWindowless: 'true',
enableHtmlAccess: 'true'
},
{
onLoad: OnHierarchyChartLoaded
},
initParam,
null);
}
</script>
</asp:Content>
I’ve inserted this JavaScript code that overrides a JavaScript function created by the “Organization Browser” SharePoint Web Control. – This customized function removes the “Claim part” of the user name that is send to the Web Server by the Silverlight Application.
NOW IT WORKS!!! – On the Claim Authentication based Web Application the “Organization Browser” can be used!!!