Problem and Workaround: Organization Browser Silverlight Web Part is empty on other site than “MySite”

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:

image

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!!!

image

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 Trauriges Smiley!!!

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!!! SmileySmileySmiley – On the Claim Authentication based Web Application the “Organization Browser” can be used!!!

Walkthrough: How to move or copy a SharePoint Designer 2010 List Workflow to another list on the same site or another site.

I had to develop a Holiday Approval Workflow with SharePoint Designer 2010. – I used a “List Workflow”. – Bad mistake! – It’s not possible to copy this kind of workflow to another list on the same site or another site.

I thought I could use the “Export to Visio” functionality with the workflow at my development site and the “Import from Visio” functionality at the destination list. – That’s impossible. You get this message:

image

(“This workflow cannot be imported because it was created in SharePoint Designer for a different site, or the original workflow has been moved or deleted. To move a workflow between sites, use Save as Template (.wsp file) instead of a Visio workflow drawing.”)

You cannot “Save as Template” because it’s a “List Workflow”.

Okay. – I’ve found a workaround.

Let’s do it in detail.

1. Create a site collection “http://sharepoint.local/sites/dev”.

2. Open SharePoint Designer 2010. Open the previously created site.

3. Open the “Workflows” view.

4. On the Ribbon click “List Workflow” and select “Shared Documents”. – We will create a workflow for the list “Shared Documents”.

image

Name the workflow “Workflow 1”. Leave “Description” empty.

image

5. Insert any workflow steps you like.

image

6. Change the workflow settings. Select “Task List” and “History List”.

image

7. Click “Publish” to publish the workflow Winking smile

8. Click “Export to Visio”. Save to Workflow as .vwi file, e.g. on the desktop.

image

9. Let’s test the workflow. – I’ve created a text file “test.txt” on the desktop. Now I upload the file to the “Shared Documents” library of “http://sharepoint.local/sites/dev”.

image

Open the item context menu. Click “Workflow”.

image

Manually start the “Workflow 1”.

*image

Click “Start”.

image

In the list view you see the workflow status.

image

Click on the status. In my case it’s “Completed”.

image

The workflow history says “Workflow executed” as specified in the workflow definition above.

10. Okay. Let’s copy the workflow to the production site “http://sharepoint.local”. – A simple “import” is impossible, because it’s a list workflow… Follow my steps.

11. Start the SharePoint Designer 2010 and open the site “http://sharepoint.local”.

12. On the Ribbon click “List Workflow” and select “Shared Documents”. – We will create a workflow for the list “Shared Documents”.

image

Name the workflow “Workflow 1 Production”. Leave “Description” empty.

image

11. Do not add any workflow step!

12. Click on “Workflow Settings” menu item on the Ribbon.

13. Click “Publish” to publish the (empty) workflow.

14. After publishing click “Export to Visio” and save the file as “workflow 1 production.vwi” on the desktop.

15. Open a Windows Explorer. Select “Desktop”. You see both “.vwi” files.

16. Add the extension “.zip” to both files.

image

 

17. Open both “.vwi.zip” files. You see:

image

18. Copy “workflow.xoml.wfconfig” from “workflow 1 production.vwi.zip” to “workflow 1.vwi.zip”.

image

19. Now remove the “.zip” extension from both files. You’ll get two “.vwi” files.

image

20. In SharePoint Designer 2010 open the site “http://sharepoint.local”.

21. Click “Import from Visio” and select “workflow 1.vwi”

image

image

Click “Next”. (Maybe you get a message: “You must close all views of this workflow before importing this file.” Then stop the import. Close all views of the Workflow and restart from Step 21.)

22. Now you see the this window:

image

That it!

23. Now the workflow designer opens:

image

24. Now you can publish the workflow and test it…

25. Be as happy as me with that !!!

PS: Of course you can use any library as destination. In the sample above it does not have to be “Shared Documents” on “http://sharepoint.local” It could be another list or library as well!