TransWikia.com

Org Browser start at a specific user for SP 2013

SharePoint Asked by Brandon Black on December 16, 2020

I have added an Organization browser to a page and was able to have it visible using the below code.

What I am wondering, is how I can have the browser begin with a specifc user and not the viewing user?

Code used:

<script type="text/javascript">
function CreateHierarchyChartControl(parentId, profileId, type, persistControlId) {
  var i = profileId.indexOf("|");
  var claimsmode = profileId.substr(i-1,1);
  if((i >=0 ) & (claimsmode=="w"))
  {
   profileId = profileId.substr(i+1,profileId.length-i-1);
   var initParam = profileId + ',' + type + ',' + persistControlId;
   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>

2 Answers

Try this one. slightly modified, finally worked for me.

<script type="text/javascript">

function CreateHierarchyChartControl(parentId, profileId, type, persistControlId, flowDirection, silverLightControlId)
{
    profileId = "WINDOWS\username"; //added line

    var initParam = profileId + ',' + type + ',' + persistControlId + ',' + flowDirection + ',' + silverLightControlId;
    var host = document.getElementById(parentId);

    host.setAttribute('width', '100%');
    host.setAttribute('height', '100%');

    Silverlight.createObject('/_layouts/ClientBin/hierarchychart.xap',
        host,
        silverLightControlId,
        {
            top: '30',
            width: '100%',
            height: '100%',
            version: '4.0.50401.0',
            isWindowless: 'true',
            enableHtmlAccess: 'true'
        },
        {
            onLoad: OnHierarchyChartLoaded
        },
        initParam,
        null);
}

</script> ​​ 

Answered by Jaitsujin on December 16, 2020

add the 'accountname' parameter to your URL:

http://www.mysite.com/orgbrowser.aspx?accountname=domain/useraccount

Not sure why you created a javascript for this though - there is a web part you can just drop into the page...

Answered by Kolten on December 16, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP