Uncategorized

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.

image

image

image 

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.

image

Also by default the site collection level feature  called “Document Site”  is also not activated , as shown below.

image

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.

image

image

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.

image

After the command is completed successfully , you can use the “Document Set” for the document library mentioned in the command as shown below.

image

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.

image

There is another optional parameter “-deactivatedocsetfeature” (as shown below)

image

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]

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s