简体   繁体   中英

How to set custom permissions on a Sharepoint Document Library and export them in a template?

Sharepoint 2010

I have 3 sets of Document Libraries that contain a number of documents organised in folders. The idea is to be able to instantiate any of those 3 document libraries for any site in the collection. So that the structure is replicated upon creation.

The issue is that the libraries have a constrained set of permissions that are different from the parent (stop inheriting permissions option). But I've noticed that when I instantiate any of the library templates the permissions aren't kept.

Is there a way to store a set of specific permissions within the template itself?

For example, this could be the structure for one of the document libraries:

  • Document 1 (accessible by all)
  • Document 2 (accessible by all)
  • Folder 1 (accessible by all)
  • >> Document 3
  • >> Document 4
  • >> Document 5
  • Folder 2 (only accessible by the management group)
  • >> Document 6
  • >> Document 7

-------EDIT---------

I have tried with the Powershell cmdlets

Exported the library with:

Export-SPWeb -Identity http://server/sites/site1/SampleLibrary -path "sampleLibraryExport.cmp" -IncludeUserSecurity -ItemUrl "3rd Party Engagements" 

Deleted the library and reimported again with:

Import-SPWeb -Identity http://server/sites/site1/SampleLibrary -path "sampleLibraryExport.cmp" -IncludeUserSecurity

However, the custom permissions are gone and have now been set to the farm-admin account and inherited across files

Thanks,

Jaume

to transfer library with permissions and store user identity you can try to use SharePoint deployment. Internally Import-SPWeb also uses SharePoint deployment but it doesn't supported well. If you'll work with SharePoint object model directly and will write some C# or PowerShell it will be possible to transfer list with permissions. You can find here some samples for transferring spweb, but also some code for lists, look at method GetExportList. I'm not pretending for ready solution, but this could be helpful for you if you'll look at SharePoint content deployment with your problem

Here's the solution that I used in the end, which involves a custom PowerShell script that loops through files and folders and sets the individually-defined permissions.

http://codebroth.com/blog/2012/10/copying-sharepoint-2010-document-libraries-wit-powershell/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM