Posts

Showing posts with the label SharePoint Widgerts

Checking user permission in SharePoint Framework (SPFx) webpart

Image
Hi Friends, Many times we need to show the controls based on the user permission while creating the custom SharePoint Framework (SPFx) webpart. The first thing we look for is the endpoint to retrieve the information from SharePoint. In this blog I will tell you how this can be achieved without any endpoint as this information is already available in the SharePoint Framework (SPFx) webpart. So, if you look into the <WebpartName>webpart.ts file , you can find this information in the current page context this .context.pageContext.web.permissions Now we get three methods with this hasAllPermissions : Checks if the user has all the permissions hasAnyPermissions : Checks if the user has any permission from the collection of permissions hasPermission : Checks if the user has given permission value : Returns the current user permission set Now talking of the permissions, you'll get a variety of permissions. For this SharePoint has the SPPermission class. ...