Organizational Browser Start Account

If you would like to create an Organizational Browser page that shows an entire organization or that starts with any user other than the one currently logged in you can do so with a Script Editor web part.  First, create a page, add the organizational browser web part and a script editor web part.  The choose the appropriate source below for your script editor and replace the DOMAIN and SAMACCOUNTNAME/USERPRINCIPALNAME and SHAREPOINT_URL_INCLUDING_SITE (example https://site.domain.com/sites/sitecollection/subsite Jump ) appropriately.  This should set the starting user for both the Silverlight and HTML Views.

This based on combining information from:

https://social.technet.microsoft.com/wiki/contents/articles/23593.sharepoint-2013-organization-browser-web-part-does-not-render-in-html-view-for-windows-claims-users/compare.aspx?revB=0&revA=1

https://social.msdn.microsoft.com/Forums/vstudio/en-US/bea636a0-dbd1-41e0-b06c-3e7f8fd067d0/calling-a-specific-user-when-using-organization-browser?forum=sharepointdevelopment Jump

and a few other sources

For SharePoint 2013

"text/javascript">
function CreateHierarchyChartControl(parentId, profileId, type, persistControlId) {
    profileId = "DOMAIN\\SAMACCOUNTNAME";
    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);
}
function OnHierarchyChartLoaded(sender) {
    var params = sender.GetHost().InitParams.split(',');
    var profileId = params[0];
    var profileType = params[1];
    var persistControlId = params[2];
    sender.GetHost().content.HierarchyChartObject.SetPersistControlId(persistControlId);
    sender.GetHost().content.HierarchyChartObject.SetProfileServiceUrl('SHAREPOINT_URL_INCLUDING_SITE');
    var lastVisitedProfile = GetLastVisitedProfile(persistControlId);
    if (lastVisitedProfile != null) {
        params = lastVisitedProfile.split(',');
        if (params.length > 1) {
            profileId = params[1];
            profileType = params[0];
        }
    }
    sender.GetHost().content.HierarchyChartObject.SetNewProfile(profileId, profileType);
}
//HTMLView
SP.UI.Portal.SimpleProfileBrowser.prototype.$2S_0 = function ($p0, $p1, $p2) {
    $p0="DOMAIN\\SAMACCOUNTNAME";
    var $v_0 = $get($p1);
    if ($v_0) {
        $v_0.innerHTML = '
'
;
        this.$h_0 = $v_0.firstChild;
        this.$16_0 = this.$h_0.nextSibling;
        this.$1e_0 = this.$16_0.nextSibling;
    }
    if ($p2) {
        this.$h_0.innerHTML = String.format(SpsClient.ScriptResources.silverlight_Install_Message, 'Silverlight');
        Sys.UI.DomElement.addCssClass(this.$h_0, 'ms-profileBrowserHeaderText');
        Sys.UI.DomElement.addCssClass(this.$h_0.firstChild.nextSibling, 'ms-profileBrowserSilverlightLink');
    }
    this.$2V_0($p0);
}
​​

 

For Office 365

"text/javascript">
functionCreateHierarchyChartControl(parentId, profileId, type, persistControlId) {
    profileId = "i:0#.f|membership|USERPRINCIPALNAME";
    varinitParam = profileId + ','+ type + ','+ persistControlId;
    varhost = 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);
}
functionOnHierarchyChartLoaded(sender) {
    varparams = sender.GetHost().InitParams.split(',');
    varprofileId = params[0];
    varprofileType = params[1];
    varpersistControlId = params[2];
    sender.GetHost().content.HierarchyChartObject.SetPersistControlId(persistControlId);
    sender.GetHost().content.HierarchyChartObject.SetProfileServiceUrl('SHAREPOINT_URL_INCLUDING_SITE');
    varlastVisitedProfile = GetLastVisitedProfile(persistControlId);
    if(lastVisitedProfile != null) {
        params = lastVisitedProfile.split(',');
        if(params.length > 1) {
            profileId = params[1];
            profileType = params[0];
        }
    }
    sender.GetHost().content.HierarchyChartObject.SetNewProfile(profileId, profileType);
}
//HTMLView
SP.UI.Portal.SimpleProfileBrowser.prototype.$36_0 = function($p0, $p1, $p2) {
    $p0="i:0#.f|membership|USERPRINCIPALNAME";
    var$v_0 = $get($p1);
    if($v_0) {
        $v_0.innerHTML = '
'
;
        this.$h_0 = $v_0.firstChild;
        this.$16_0 = this.$h_0.nextSibling;
        this.$1e_0 = this.$16_0.nextSibling;
    }
    if($p2) {
        this.$h_0.innerHTML = String.format(SpsClient.ScriptResources.silverlight_Install_Message, 'Silverlight');
        Sys.UI.DomElement.addCssClass(this.$h_0, 'ms-profileBrowserHeaderText');
        Sys.UI.DomElement.addCssClass(this.$h_0.firstChild.nextSibling, 'ms-profileBrowserSilverlightLink');
    }
    this.$39_0($p0);
}
 
Thanks to:
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s