3

In site setting I want to hide a link in the Site Actions group from the Full Control users.

enter image description here

Anyone can point me to the right direction?

0

As Modify Site Metadata seems like it's a custom action, you need to return to the code used to add it. CSOM accepts Rights attribute, which are based on SPBasePermission enumeration. You need to define a higher-than-site-owner-level permission right, which would be ManageWeb.

So, add the following to your code:

Rights = "ManageWeb"

The complete code would be something like:

UserCustomAction siteAction = clientContext.Web.UserCustomActions.Add();
siteAction.Group = "SiteActions";
siteAction.Location = "Microsoft.SharePoint.StandardMenu";
siteAction.Name = "Sample_CustomAction";
siteAction.Sequence = 1000;
siteAction.Url = string.Format(DeployManager.appUrl, clientContext.Url); ;
siteAction.Title = "Modify Site Metadata";
siteAction.Rights = "ManageWeb"; 
siteAction.Update();
clientContext.ExecuteQuery();

References 1 & 2.

  • May I ask why -1? – moe Jun 16 '17 at 15:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.