question

weisnh avatar image
0 Votes"
weisnh asked weisnh commented

Regarding SharePoint 2019 On Premise CustomAction/ CustomActionGroup Element

Hi there,

I create a custom application page with custom action element. the custom action element will used to control the permission of link in the site settings. you could refer to the following image. Unfortunately, when I deploy to the SharePoint Farm and test this by using two different permissions. it turns out that (1) User is Site Administrator (Site Collection Administrator), works well. (2) User is Site Owner or Full Control, the user CANNOT see the link in the site settings.

Is the function supported by SharePoint 2019 on premise or there is something missing. Thanks

33992-untitled.png






office-sharepoint-server-developmentoffice-sharepoint-server-customization
untitled.png (287.9 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

BakerKong-MSFT avatar image
0 Votes"
BakerKong-MSFT answered weisnh commented

Hi @weisnh,

I tested below 4 scenaios:

 <?xml version="1.0" encoding="utf-8"?>
 <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    
     <CustomActionGroup
         Description = "fffffffff"
         Id = "PS.SiteOwnerReports"
         Location = "Microsoft.SharePoint.SiteSettings"
         Sequence = "10000"
         Title = "Test permissions">
     </CustomActionGroup>
    
    
     <CustomAction
         GroupId ="PS.SiteOwnerReports"
         Id="ViewAllPermissions.SiteSettings"
         Location="Microsoft.SharePoint.SiteSettings"
         Sequence="10001"
         Title = "FullMask-False"
         RequireSiteAdministrator="False"
         Rights="FullMask"
     >
         <!-- 
     Update the Url below to the page you want the custom action to use.
     Start the URL with the token ~remoteAppUrl if the page is in the
     associated web project, use ~appWebUrl if page is in the add-in project.
     -->
         <UrlAction Url="~site/_layouts/SharePointProject1/ApplicationPage1.aspx" />
     </CustomAction>
    
     <CustomAction
         GroupId ="PS.SiteOwnerReports"
         Id="ViewAllPermissions.SiteSettings"
         Location="Microsoft.SharePoint.SiteSettings"
         Sequence="10001"
         Title = "FullMask-True"
         RequireSiteAdministrator="True"
         Rights="FullMask"
     >
         <!-- 
     Update the Url below to the page you want the custom action to use.
     Start the URL with the token ~remoteAppUrl if the page is in the
     associated web project, use ~appWebUrl if page is in the add-in project.
     -->
         <UrlAction Url="~site/_layouts/SharePointProject1/ApplicationPage1.aspx" />
     </CustomAction>
    
    
    
     <CustomAction
         GroupId ="PS.SiteOwnerReports"
         Id="ViewAllPermissions.SiteSettings"
         Location="Microsoft.SharePoint.SiteSettings"
         Sequence="10001"
         Title = "ManageWeb-False"
         RequireSiteAdministrator="False"
         Rights="ManageWeb"
     >
         <!-- 
     Update the Url below to the page you want the custom action to use.
     Start the URL with the token ~remoteAppUrl if the page is in the
     associated web project, use ~appWebUrl if page is in the add-in project.
     -->
         <UrlAction Url="~site/_layouts/SharePointProject1/ApplicationPage1.aspx" />
     </CustomAction>
    
     <CustomAction
         GroupId ="PS.SiteOwnerReports"
         Id="ViewAllPermissions.SiteSettings"
         Location="Microsoft.SharePoint.SiteSettings"
         Sequence="10001"
         Title = "ManageWeb-True"
         RequireSiteAdministrator="True"
         Rights="ManageWeb"
     >
         <!-- 
     Update the Url below to the page you want the custom action to use.
     Start the URL with the token ~remoteAppUrl if the page is in the
     associated web project, use ~appWebUrl if page is in the add-in project.
     -->
         <UrlAction Url="~site/_layouts/SharePointProject1/ApplicationPage1.aspx" />
     </CustomAction>
    
 </Elements>

The result is:

  • If the user is site collection administrator, then he is able to see all links

35334-test.gif

  • If the user is only site owner, then he can only see the links that have 'false' RequireSiteAdministrator

35270-test.gif

So I think you may need to set RequireSiteAdministrator to false. Below is my test demo.

Best Regards,
Baker Kong


If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


test.gif (423.3 KiB)
test.gif (659.0 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi BakerKong,

Thanks for your information, I try these configurations on my client's environment. It cannot work well. I look into what happened in their server farm. I figure out the Element is not updated, when I update the SharePoint Solution by PowerShell. Finally, I updated the Element.xml manually and the problem went away.

Thanks for your help once again.

0 Votes 0 ·
BakerKong-MSFT avatar image
0 Votes"
BakerKong-MSFT answered weisnh commented

Hi @weisnh,

Based on the docs, RequireSiteAdministrator is used to specify that the item be displayed only if the user is a site administrator. Administrator is not equal to Site owner. For more details, please refer to :

Best Regards,
Baker Kong


If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi BakerKong,

I found the problem is <Right="FullMask">. Normally, FullMask = Site Owner. But when I change the <Right="ManageWeb">, the user with site owner permission can see the link. I cannot understand if my account is Site Owner the setting must be <ManageWeb> instead of <FullMask>

0 Votes 0 ·