Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

SPControl.SetContextWeb

  Asked By: Garret    Date: May 10    Category: Sharepoint    Views: 1576

Anyone have experience using the method SPControl.SetContextWeb? I am
wondering if I could use this method to solve my ealier post about
using the ListProperty on subsites?

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Vance Hardin     Answered On: May 10

You will want to use something like the following C# code...

//Get specific specified Site Collection
//Fully qualified URL to Site Collection like: "http://[site]"
SPSite siteCollection = new SPSite(this.SpecifiedSiteColleciton);

//Get root Web of Site Collection
SPWeb web = siteCollection.RootWeb;

//OR Get child Web of Site Collection, root relative reference like:
"/sites/Embedded/ChildSite"
//If an empty string is provided, the code will return the root Web
SPWeb web = siteCollection.OpenWeb(SpecifiedChildWeb);

 
Didn't find what you were looking for? Find more on SPControl.SetContextWeb Or get search suggestion and latest updates.

Related Topics:



Tagged:    

 

Related Post