2/13/2012

SharePoint: Finding the Site GUID

 

Had a nice quite evening planned, and then someone sends me in search of a wild goose... 

Because of a security issue they could not use my little GUID getter tool on their site and they were looking for some other way of getting a site GUID.

The wild goose hunt paid off as I found two…

For those who have bought my book, you may want add a note on page 307 to see this article.

 

1) Wiki home page:
Works for SP 2010 only: Display a Team Site home page (a wiki home page, home.aspx) that has at least one list web part, view the source of the page (right-view source) and search for "RelatedWebId"  (you could temporarily add an Announcements or library web part to the page)

    WebPartWPQ2_RelatedWebId="{f70832a4-5d0d-4265-a344-ea10a0007160}"

2) Tree View:
Works for both SP 2007 and SP 2010: Go to Site Actions, Site Settings, Tree View and enable Tree View. Then go to any page, view source and search for "ListNode:"

   spNavigateHierarchy(this,'','30:ListNode:f70832a4-5d0d-4265-a344-ea10a0007160:740...

 

Here's one for the PowerShell users that requires admin access to the servers:


Open "SharePoint 2010 Management Shell"  (PowerShell for SharePoint)
Enter:
  $site = Get-SPSite  http://yourserver/sites/yoursitename
  $web = $site.AllWebs["yoursubsitename"]     or  $site.RootWeb   for the root site
  $web.ID
    Guid
    ----
    f70832a4-5d0d-4265-a344-ea10a0007160

 

I guess the wild goose chase at least got me another blog article.  :-)

 

.

No comments:

Note to spammers!

Spammers, don't waste your time... all posts are moderated. If your comment includes unrelated links, is advertising, or just pure spam, it will never be seen.