Create a SharePoint Global Site Directory

(See the updated version of this for SharePoint 2010)

 

There are plenty of strategies for developing a global site directory for SharePoint. But a common request is to be able to list all of the sites that the current user has access to. One way to do this would be to write code that iterates though all of the sites in every site collection in every application and checks their permissions. That would function, but of course, performance would be awful. If you have MOSS, the search index already has the list of sites and permissions. All we have to do is write the query. And, since SharePoint designer can work with web services, there’s no code required. The major flaw with this method is that the data is as current as the index. So if someone just gained permission to a site, it will not show up in this list until the next time the indexer runs.

In SPD, get to the data sources window, and add a new “XML Web Service” source
In the data source properties dialog, set the location to the search.asmx web service, and click connect now.Make certain you select the QueryEx operation, and not the default Query. Query will return a blob of xml, QueryEx returns a dataset. Of course, a dataset is still xml, but it will be in a format that SPD knows how to use.The bottom of the dialog will then show that there is one parameter, the query Xml. So, click on modify, and …
Paste in: <QueryPacket xmlns=’urn:Microsoft.Search.Query’><Query><SupportedFormats><Format revision=’1′>urn:Microsoft.Search.Response.Document:Document</Format></SupportedFormats><Context><QueryText language=’en-us’ type=’MSSQLFT’>select title, path, Description from scope() where (contentclass = ‘STS_Web’ or contentclass = ‘STS_Site’) and path not like ‘%ssp/admin%’ order by title</QueryText></Context><Range><StartAt>1</StartAt><Count>1000</Count></Range></Query></QueryPacket>

(*Thanks to Brian Phillips for the sql portion of the above query:

http://groups.google.com/group/microsoft.public.sharepoint.windowsservices/browse_thread/thread/2316f7bdbb95a79f?pli=1 )

The queryXml deserves its own chapter in a book. Certainly, one of the key pieces is the select statement embedded in the middle. For more info on what’s available, do a search for MSSQLFT, or take a look here:
http://msdn.microsoft.com/en-us/library/ms443580.aspx

Note that the “where” statement is the key here, without it the search would be returning all content in SharePoint, including documents, list items, etc. (which is actually pretty fantastic, but not what I’m trying to do here)

Also note that the above will only return the first thousand sites(which is probably overkill).

Click ok, and then click on the drop down next to the queryservice that was just created, and select “show data”
Scroll to the bottom of the long list of fields, and find the three that were mentioned in the select statement: title, path, and description
Select title and description fields, and select “insert as multiple item view”
To make the title a hyperlink, click the button that appears when you hover over the title field, and select to format the field as ahyperlink.
Then, just make sure that the text to display is the TITLE (case sensitive, and with the {}, just as in the screen shot) and the address should use the PATH field. edithyperlink

That’s it! Just spend some time formatting it. Of course, you could always export it as a web part (file menu), and then drop it on a page if you don’t want a whole page devoted to it.

Advertisements

5 thoughts on “Create a SharePoint Global Site Directory

  1. Kat

    This is an awesome post and exactly what I was looking for. I have one thing I need to change and I’m hoping you might be able to help me. I need to query for the list of subsites that the current user has contribute rights for not just view. I would so appreciate it if you could help me with that or point me in the right direction.

    Reply
  2. Chiliyago

    I experienced this problem where Data Sources created by one user are not visible by another. RT @TimOdell: Data Sources Not Visible between Users sharepoint.stackexchange.com/q/38640/908?st… @WonderLaura Have you seen this before?

    Reply

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