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

  1. Martin Winzig says:

    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.

  2. Martin Winzig says:

    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 :(