Getting the PSI URL from an Event Handler

Hello,

There have been a few question with regards to how to get the PSI URL from an event handler. To get the URL, you will need to call into the SharePoint object model. So the first step is to create a reference to it:

using Microsoft.SharePoint;

Then you are going to need to create a SPSite object, passing in the Site GUID which is a property of the ContextInfo object that is passed into the event handler:

SPSite ss= new SPSite(contextInfo.SiteGuid);

From the SPSite object, you can build up the URL to the PSI:

string.Format("{0}/_vti_bin/psi/{1}.asmx",ss.Url, wsName);

For impersonation, you will want to use:

string.Format("{0}//{1}:56737/{2}/psi/{3}.asmx", ss.Protocol, ss.HostName, sspName, wsName);

Chris Boyd

Comments

  • Anonymous
    January 10, 2008
    PingBack from http://geeklectures.info/2008/01/10/getting-the-psi-url-from-an-event-handler/

  • Anonymous
    January 12, 2008
    I Still don't know how to get information about SSP url from SPSITE , and mainly i have no idea how to get SSP from project server event handler.

  • Anonymous
    January 12, 2008
    I did also my homework, I'm able detect sspName but I dont know it my SSP using SSL and which SSP using my project server instance. I think that my homework is litle bit better but still unusable in production environment :(