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