Posts

Showing posts from 2022

Disable list view selection for users on SharePoint Online using SPFx Application Extension

Image
 Recently we ran into an issue on SharePoint Online that user should be able to see only their records in a list and not otehrs. So we had updated the default list view filter with Employee equal to [Me].  We have also created a view "Admin" with no filter so admins can see all records. However, the view selection is still enabled as they have View permission and hence the users can switch to Admin views and see all records, see below screenshot: So to solve this issue, we created a very simple SPFx Application customizer extension such that it hides the entire list comand bar for normal users, and shows it for only site admins. See the end result for Site admins and Normal users: Open the node.js command prompt and start eith the yeoman scaffolding: Select the type of client-side component as Exension Select the type of extension to be Application Customizer Open the solution in VS Code Create a new CSS file in this path: src > extensions > appExtensionDemo > mysty

SharePoint Custom Access Denied Page

Creating a custom Access Denied page to match the site branding and client requirement is one of the requirement in most of the projects. In Microsoft SharePoint, it has a default Acess denied page. To customize and build our own Acess Denied page, follow the below steps. On the SharePoint server, navigate to : C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\TEMPLATE\LAYOUTS Create new folder: UserCustomPages From the /Layouts folder, copy AccessSenied.aspx file paste into the new folder(UserCustomPages). Rename the file to customAccessDenied.aspx and modify it as per the requirement, save it. Open SharePoint management shell Execute below scripts: get-spcustomlayoutspage -webapplication "http://your-site-url" This will show the default Access denied page used. set-spcustomlayoutspage -Identity "AccessDenied" -RelativePath "/_layouts/15/UserCustomPages/customAccessDenied.aspx" -webapplication "http://your-site-url" Thi