title: How to set custom permissions on a Sharepoint Document Library and export them in a template?
body: <p>Sharepoint 2010</p>
  
  <p>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.</p>
  
  <p>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.</p>
  
  <p>Is there a way to store a set of specific permissions within the template itself?</p>
  
  <p>For example, this could be the structure for one of the document libraries:</p>
  
  <ul>
  <li>Document 1 (accessible by all)</li>
  <li>Document 2 (accessible by all)</li>
  <li>Folder 1 (accessible by all)</li>
  <li>>> Document 3</li>
  <li>>> Document 4</li>
  <li>>> Document 5</li>
  <li>Folder 2 (only accessible by the management group)</li>
  <li>>> Document 6</li>
  <li>>> Document 7</li>
  </ul>
  
  <p>-------EDIT---------</p>
  
  <p>I have tried with the Powershell cmdlets</p>
  
  <p>Exported the library with:</p>
  
  <pre><code>Export-SPWeb -Identity http://server/sites/site1/SampleLibrary -path "sampleLibraryExport.cmp" -IncludeUserSecurity -ItemUrl "3rd Party Engagements" 
  </code></pre>
  
  <p>Deleted the library and reimported again with: </p>
  
  <pre><code>Import-SPWeb -Identity http://server/sites/site1/SampleLibrary -path "sampleLibraryExport.cmp" -IncludeUserSecurity
  </code></pre>
  
  <p>However, the custom permissions are gone and have now been set to the farm-admin account and inherited across files</p>
  
  <p>Thanks,</p>
  
  <p>Jaume</p>