If you saw my last post, Exporting List Security Settings, then you know what this post is all about. I needed a way to be able to copy the security settings from one variation to another or from one farm to another. I already had my gl-copylistsecurity command which could handle the first piece of this but I needed another set of commands to handle going from one farm to another. The first was gl-exportlistsecurity which handles the exporting - the second command is, obviously enough, gl-importlistsecurity.
Like the export code this was fairly easy for me to do because I already had the code for the copy command - it was just a matter of refactoring it so that the source could be an XML file rather than another list:
This command simply takes in the output from the gl-exportlistsecurity command so naturally anything that command doesn't support this one won't either. The syntax can be seen below:
C:\>stsadm -help gl-importlistsecurity stsadm -o gl-importlistsecurity Imports security settings using data output from gl-exportlistsecurity. Parameters: -url <url to import security to> -inputfile <file to import settings from> [-quiet] [-includeitemsecurity]
The following table summarizes the command and its various parameters:
|Command Name||Availability||Build Date|
|gl-importlistsecurity||WSS v3, MOSS 2007||Released: 4/12/2008
|Parameter Name||Short Form||Required||Description||Example Usage|
|url||Yes||The web URL to import the security settings to.||-url http://portal|
|inputfile||file||Yes||The file with the security information to import.||-inputfile "c:\security.xml"
|quiet||No||If specified then progress information will not be output to the console.||-quiet|
|-includeitemsecurity||items||No||If specified then item level security will be imported.||-includeitemsecurity
Here's an example of how to import the security settings:
stsadm -o gl-importlistsecurity -url http://portal/documents/forms/allitems.aspx -inputfile c:\security.xml
Update 8/28/2008: I've updated the code so that it now supports importing item level security.