Skip to content

Instantly share code, notes, and snippets.

@soen
Last active May 29, 2016 11:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save soen/f486252d0537ae081134fa22a0ae8f3b to your computer and use it in GitHub Desktop.
Save soen/f486252d0537ae081134fa22a0ae8f3b to your computer and use it in GitHub Desktop.
SiteContext targetSiteContext = SiteContext.GetSite(sitename);
using (var context = new SiteContextSwitcher(targetSiteContext))
{
// do something on the new site context
Item myItem = context.Database.GetItem("ID");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment