Sunday, March 2, 2014

Enable Item-Level Permissions on Document Library in SharePoint using PowerShell

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!

item level permission in sharepoint 2013 document library
These settings configures ReadSecurity and WriteSecurity properties of SPList object.

Change Read Security with PowerShell:
$web = Get-SPWeb "http://Your-SharePoint-Site"
$list = $web.Lists["Your Document Library Name"]
$list.ReadSecurity = 2
  • Read all items: 1
  • Read items that were created by the user: 2
Change Write Security permissions programmatically:
$web = Get-SPWeb "http://Your-SharePoint-Site"
$list = $web.Lists[“Your Document Library Name”]
$list.WriteSecurity = 2
  • 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!

You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.

Check out these SharePoint products:

No comments :

Post a Comment

Please Login and comment to get your questions answered!

You might also like:

Related Posts Plugin for WordPress, Blogger...