Byte My Data

A personal collection of advice and solutions I've used.

About the author

Something about the author

Get the URI of the root SharePoint site in a web application and instantiate a SPWeb object for it

Here's the code from the previous post,

 

// The SharePoint portal URI of the root site.
var portalUrl = new Uri(Request.Url.GetLeftPart(UriPartial.Authority));
// The SharePoint sub site.
var portalSite = Request.QueryString["site"];
.
.
.
// Instantiate the SharePoint website object located at [portalUrl]/[portalSite].
SPWeb mySite = SPWebApplication.Lookup(portalUrl).Sites[portalSite].AllWebs[portalSite];

Categories: .NET | ASP.NET | C# | SharePoint
Permalink | Comments (1) | Post RSSRSS comment feed

Comments

Prep Material United Kingdom

Wednesday, February 01, 2012 1:49 PM

Prep Material

This is a great inspiring article. I am pretty much pleased with your good work. You put really very helpful information. Keep it up. Keep blogging. Looking to reading your next post.

Add comment




  Country flag

biuquote
  • Comment
  • Preview
Loading