MOSS MVP

I've moved my blog to http://blog.falchionconsulting.com!. Please update your links. This blog is no longer in use--you can find all posts and comments at my new blog; I will no longer be posting to this site and comments have been disabled.

Thursday, August 9, 2007

Setting the Master Site Directory

One of the things I needed my upgrade script to do was to set the master site directory. This can be done easily enough using the central admin tool (Central Administration > Operations > Site Directory Settings). I took most of my code from what I disassembled using Reflector. The code itself just grabs a PortalService object which it then uses to set the settings. You also need to get an SPSite and SPWeb object in order to set the settings correctly. The syntax of the command can be seen below.

C:\>stsadm -help gl-setmastersitedirectory

stsadm -o gl-setmastersitedirectory

Sets the master site directory.

Parameters:
        -url <site directory url>
        [-enforcelistinginsitedir]
        [-sitedirentryrequirement <0=none, 1=at least one category, 2=all categories>]

Here’s an example of how to set the master site directory:

stsadm –o gl-setmastersitedirectory –url “http://intranet/sitedirectory/” –enforcelistinginsitedir -sitedirentryrequirement 1

In a later post I'll be showing how to create the columns for the site directory (involves manipulating the list entry).

4 comments:

Manish Goyal said...

Hello
Can you please explain what functionality is achieved with the Master site directory settings. I am not able to get idea what it does.

Manish
http://manish-sharepoint.blogspot.com

Gary Lapointe said...

Manish - The master site directory is intended to store the listing of site collections. So if your environment is set up so that users are able to create new site collections then the master site directory could be useful as that site collection will be listed in the master site directory. However, any sub-sites that are created will not be listed unless they are manually added. For sub-sites you would create another site directory within the site collection and store them there. For an environment with very few site collections the master site directory is fairly limited in its use unless you want users to manually enter their site into the list.

Anonymous said...

Hi,
I have installed the wsp.
I have created a Expiration formula and it calculates the expirydate. I want to send a mail on expirydate. I have chosen my formula a expiration formula and selected my action. I want to run this job everyday.
I had executed the command stsadm -o gl-execadmsvcjobs.
It executes but i am not able to see the action performing.

Gary Lapointe said...

gl-execadmsvcjobs just blocks until all pending administrative timer jobs have completed. What you need to do is create a new timer job. There's tons of resources on how to do this (Andrew Connell has a series of blog posts that may help you).