Is this any help?
As the admin, how can I create a personal view for others Employee by script
We need to set up around 60 personal views for employees, The personal view will be filtered by department and team in two columns and it will display 4-6 columns. We don't want to have a meeting with all the 60 employees to manually create this personal view, wondering if there is a PNP script that can use to create a personal view for that person.
I saw there is Add-PnPView below, saw the Personal is true and should be personal, but how can I set it up for one specific employee.. did not see the options below.
Add-PnPViewsFromXML, if I use this script, what is format of xml to include the filter by department, choose 4-6 columns and personal view true and this personal view is for one employee.
Thanks,
Kathy
Add-PnPView [-List] <ListPipeBind> -Title <String> [-Query <String>] -Fields <String[]> [-ViewType <ViewType>]
[-RowLimit <UInt32>] [-Personal] [-SetAsDefault] [-Paged] [-Aggregations <String>]
[-Connection <PnPConnection>]
3 answers
Sort by: Most helpful
-
-
Kathy Li 0 Reputation points
2023-09-09T21:04:36.7666667+00:00 Another solution works but missing one feature. I used SharePoint Designer 2013 to create a view and make it a file copy to the document library and opened it from the browser to set up the unique permission and copy back to the list. it works but the issue with this solution is the dropdown shows all 60 views for all users, and if you don't have permission and click the view the page will display as "Invalid something wrong message", If I can make the view only display for that person has permission, this method works too, but I cannot find a solution, so I change to create a personal view. By creating personal views, if I can grab all of them in the meeting and show them how to create, it works too. But now, really don't want to go in that direction and seek what is best approach with less interactive with end users. Thanks
-
Ling Zhou_MSFT 16,740 Reputation points Microsoft Vendor
2023-09-11T05:29:08.16+00:00 Hi @Kathy Li,
Thank you for posting in this community.
I would like to confirm your question with you first: you want 60 employees to create their own views through departments and teams. Please correct me if I am wrong.
The fact is that views don't have permissions in SharePoint, and we can't add permissions to views to determine which views those users can access.
Here I am providing an alternative solution that can be used, hope it helps you.
I will create a Person column (the column name is "name" in my test) in the list, which will mark that the user is allowed to view the information in that row.
Let's take an example, there are two people, Karley and Wendy, on team A in department A, and one person, Jinwei Li, on team B in department B. Karley's and Wendy's view should see one row each for their department, A, and team A. Jinwei Li's view should see a single record that says her department is B and her team is B.
Next, create a new view, edit the view and add a filter :name is equal to [ME].
Here [ME] is the equivalent of a variable that represents the currently logged in user.
After saving the view, don't forget to set the current view as the default view.
Karley's Personal view:
Wendy's Personal view:
Jinwei Li's Personal view:
There are pros and cons to this approach:
- First, it does do the job of showing different users what they should be looking at, and only creates one view.
- However, there is redundancy in the information saved in the list for the other columns.
- In fact, all users can see all the information by switching the "All Items" view. This is not safe. You can also choose to delete this "All Items" view. However, it will be difficult for the administrator to see all the information, which is not good for the maintenance of the list.
If you want different users to be able to quickly see what information they have access to, then this is the way to go.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
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.