none
How to get a Project's UID for its Project Site RRS feed

  • Question

  • Hey folks, is there a way, using the PSI, to obtain the Project UID of a Project's WSS site?

    So, if I've a URL, say, http://ps2010demo/pwa/projectsite1, is there a way using the PSI to get the UID for the project ProjectSite1?

    I've seen code to query the database directly, but I'd like to go through the PSI if possible.

    Thanks!! - M


    Michael Mukalian | Jan 2010 - Dec 2010 MVP SharePoint Services | MCTS: MOSS 2007 Configuration | http://www.mukalian.com/blog


    Monday, July 29, 2013 8:51 PM

Answers

  • It is stored in the property bag of the site, no need to go to the DB just use the SP object model to get the MSPWAPROJUID property. Paul

    Paul Mather | Twitter | http://pwmather.wordpress.com | CPS

    Monday, July 29, 2013 10:27 PM
    Moderator
  • There might be a way to get it from PSI, though I haven't tried that but you can get the current project site's Project UID by using the following code ( no need to hit the db).

     using (SPSite site = new SPSite(SPContext.Current.Web.Url))
                {
                    using (SPWeb web = site.OpenWeb())
                    {
                        string strProjectGUID = web.AllProperties["MSPWAPROJUID"].ToString();
                    }
                }

    Note: This should run within project site scope.

    HTH


    IN
    Thanks, Kashif

    Monday, July 29, 2013 10:32 PM

All replies

  • It is stored in the property bag of the site, no need to go to the DB just use the SP object model to get the MSPWAPROJUID property. Paul

    Paul Mather | Twitter | http://pwmather.wordpress.com | CPS

    Monday, July 29, 2013 10:27 PM
    Moderator
  • There might be a way to get it from PSI, though I haven't tried that but you can get the current project site's Project UID by using the following code ( no need to hit the db).

     using (SPSite site = new SPSite(SPContext.Current.Web.Url))
                {
                    using (SPWeb web = site.OpenWeb())
                    {
                        string strProjectGUID = web.AllProperties["MSPWAPROJUID"].ToString();
                    }
                }

    Note: This should run within project site scope.

    HTH


    IN
    Thanks, Kashif

    Monday, July 29, 2013 10:32 PM
  • Folks, thanks for the quick response and the answers.

    Marked both as answers as one mentioned the property and the other shows the implementation.

    Thanks again! - M


    Michael Mukalian | Jan 2010 - Dec 2010 MVP SharePoint Services | MCTS: MOSS 2007 Configuration | http://www.mukalian.com/blog

    Tuesday, July 30, 2013 11:40 AM