Setting the Master Site Directory

Posted on Posted in SharePoint 2007, STSADM Commands

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.

        -url <site directory url>
        [-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 thoughts on “Setting the Master Site Directory

  1. 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.

  2. 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.

  3. 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).

Comments are closed.