Enable Item-Level Permissions on Document Library in SharePoint using PowerShell
Requirement: Enable item level permissions in SharePoint document library.
SharePoint Lists provide item level security options such as “Read items that were created by the user” or “Create items and edit items that were created by the user” under “Advanced Settings” page in SharePoint list settings.
But you don’t get these options to set Item level security in SharePoint document libraries! Say your requirement is to restrict users to view and edit other’s documents and allow only their own documents in a document library! If you need these options, you can utilize PowerShell to enable Item level permissions on SharePoint document libraries as there is no UI available!
These settings configures ReadSecurity and WriteSecurity properties of SPList object.
Change Read Security with PowerShell:
$web = Get-SPWeb "https://Your-SharePoint-Site" $list = $web.Lists["Your Document Library Name"] $list.ReadSecurity = 2 $list.Update() $web.Dispose()
- Read all items: 1
- Read items that were created by the user: 2
Change Write Security permissions programmatically:
$web = Get-SPWeb "https://Your-SharePoint-Site" $list = $web.Lists[“Your Document Library Name”] $list.WriteSecurity = 2 $list.Update() $web.Dispose()
- Create and edit All items: 1
- Create items and edit items that were created by the user: 2
- None: 4
Please note, These settings will not have any effect for Site owners and administrators!
4 thoughts on “Enable Item-Level Permissions on Document Library in SharePoint using PowerShell”
Never mind, I was able to set the Item-Level permission in SharePoint Online, Document Library, using the pnp powershell you shared in one of your blog titled “How to Set Item-Level Permissions in a List?”, link below. Much appreciated for the great work!
#Read more: https://www.sharepointdiary.com/2019/05/sharepoint-online-set-item-level-permission-in-list.html#ixzz6oYAtLLFA
Hey buddy, can you please share your findings. Many thanks in advance. I get an error when I try to run the commands from the link you provided.
I guess the above powershell only works in SharePoint On-premise document library. Do you have similar powershell to use for SharePoint Online Document library? Thank you so much!
Sadly – document library item level permissions have been deprecated. Now you have to explicitly create folders and share it for each person in your team.