|
In my current project, there is a need for me to create a custom list under the Shared Services Provider (SSP) administration web site to put some configuration values. As a Sharepoint developer, what comes next is that we need to get the Site object first, before we can get the List under it. However, there wasn't any straight-forward way to get the SSP administration web site address, given only the SSP Name. The only hint I have is that you can get the ServerContext object, by providing the SSP name. string sspName = "MySharedServices"; ServerContext ctx = ServerContext.GetContext(sspName);
I've been trying to look for the methods or classes that serves my need. Finally, this is the only way I know to get the SSP web site from the SSP name. It's using a little bit of reflection. string sspName = "MySharedServices"; ServerContext ctx = ServerContext.GetContext(sspName);
Guid siteGuid = (Guid) ctx.GetType().GetProperty("SharedServiceAdministrationSiteId", -1, null, Type.GetType("System.Guid"), new Type[0], new ParameterModifier[0]).GetValue(ctx, null); SPSite site = new SPSite(siteGuid); Be first to comment this article | Views: 585 |