Thursday, January 14, 2016

How to show ribbon to admin only Sharepoint 2013

Progrmatically in SharePoint masterpage:

 

if (response.d.IsSiteAdmin){

   document.querySelector("#RibbonContainer").style.display = 'block';

}

 

 

HTML Master Page in SharePoint :

 

<!--CS: Start Security Trim Snippet-->

    <!--SPM:<%@Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>-->

    <!--MS:<SharePoint:SPSecurityTrimmedControl runat="server" AuthenticationRestrictions="AuthenticatedUsersOnly" Permissions="AddAndCustomizePages" PermissionContext="RootSite">-->

        <!--PS: Start of READ-ONLY PREVIEW (do not modify)--><span><!--PE: End of READ-ONLY PREVIEW-->

            <div id="s4-ribbonrow" class="s4-pr s4-ribbonrowhidetitle">

            ...

            </div>

        <!--PS: Start of READ-ONLY PREVIEW (do not modify)--></span><!--PE: End of READ-ONLY PREVIEW-->

    <!--ME:</SharePoint:SPSecurityTrimmedControl>-->

    <!--CE: End Security Trim Snippet-->

 

 

 

 

 

No comments:

Post a Comment