SharePoint 2010 : Command Line Utility to Enable/Disable Document Set
SharePoint 2010 provides a functionality called “Document Set” , very simply put its a way to treat group of documents as a single unit ,from technicall point “Document Set” are implemented as a content type , and this is where they receive great deal of power from, plus they get there own welcome page such that users know what the particular document set is all about. See the following screen shots below.
After working with them for a while , I realize that before you can put them to use you need to go through number of configuration steps which may be bit of annoyance if you have more than few libraries.You need to do these for each document library you want to use document set with. In fact the administrators , who are in general not a big fan of doing things UI , lament about. After checking both stsadm and powershell commands none of them carter this scenario.
I develop a simple command line utility “ManageDocumentSet” using SharePoint 2010 Server Side object Model , that will enable/disable document set content type to any document library of choice. Following is the simple walk through with screen shots on how to use this utility. Please take note that I only moderately test the utility. Perhaps I will do some good deal of tests when I have some free time . I am also looking forward to made this utility available as stsadm command extension and as a Powershell command let.
Before executing the utility , lets take a look at document library (see image below) , to which “Document Set” content type is not associated.
Also by default the site collection level feature called “Document Site” is also not activated , as shown below.
The command will activate the feature (if not already activated) . To get more information on allowed parameters type “managedocumentset -help” or simply “managedocumentset” on the command line as shown below.
Enabling Document Set for a document library
For enable a document set on a document library , you can use the following parameters.
“managedocumentset” is the name of the command line utility.
the four required parameters are
- enable : Enable the the document set for a particular document library . Alternative is “-disable” (discussed in next section.)
- site : Its the absolute URL of the sitecollection e.g “http://win28k” , “http://win28k/sites” , etc.
- web : Its a name of the web (SPWeb) , inside the site collection provided in parameter “site” . e,g “/” for root web , “PressReleases” , etc.
- libname : Name of a document library with which the Document Set content type will be associated. e.g “Documents” , “HRDocuments”, etc.
After the command is completed successfully , you can use the “Document Set” for the document library mentioned in the command as shown below.
Disabling Document Set for a document library
To disable a document set on a document library , use the following command parameters.
“managedocumentset” is the name of the command line utility.
The four required parameters are
- disable : Disable the the document set for a particular document library . Alternative is “-enable” (discussed in previous section.)
- site : Its the absolute URL of the sitecollection e.g “http://win28k” , “http://win28k/sites” , etc.
- web : Its a name of the web (SPWeb) , inside the site collection provided in parameter “site” . e,g “/” for root web , “PressReleases” , etc.
- libname : Name of a document library with which the Document Set content type will be disassociated. e.g “Documents” , “HRDocuments”, etc.
There is another optional parameter “-deactivatedocsetfeature” (as shown below)
Normally “-deactivatedocsetfeature” parameter will deactivate the “Document Set” feature , however do take note that in case the “Document Set” content type is in use , the feature will not be deactivated , and you will receive a standard message from SharePoint mentioning that content type is in use.
[NOTE: The utility is written against SharePoint 2010 Beta 2 version, and may not work in RTM version]
Originally published on WordPress on 2010-01-06.
Read next
-
MVP SharePoint Chat — Wednesday May 25th at 9am PDT
When: 9 AM PDT, 25th May 2011 (PDT? Convert to your time zone here) Where: Online | Enter Chat Room Do you have tough technical questions regarding SharePoint for which you're seeking answers? Do…
-
How to fix SharePoint Online (403) Forbidden Error while downloading files using Client Object Model
Recently I was working on a project that requires to programmatically access and download files from SharePoint Online (part of Office 365) document library. Currently remote authentication (SP…
-
Office 365 Session @ Microsoft NYC
As Office 365 goes into public beta, it's time to dig deeper into the features of Office 365. I am conducing a session on Office 365 with demo of its services @ Microsoft NYC on 27th April 2010…
Worth reading again?
Get the next one in your inbox.