Skip to content

Instantly share code, notes, and snippets.

@Vintaurus
Created December 27, 2017 15:22
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 Vintaurus/408ebce67bb37021127b9c4204702bd3 to your computer and use it in GitHub Desktop.
Save Vintaurus/408ebce67bb37021127b9c4204702bd3 to your computer and use it in GitHub Desktop.
protected void Page_Load(object sender, EventArgs e)
{
// The following code gets the client context and Title property by using TokenHelper.
// To access other properties, the app may need to request permissions on the host web.
var spContext = SharePointContextProvider.Current.GetSharePointContext(Context);
using (var clientContext = spContext.CreateUserClientContextForSPHost())
{
clientContext.Load(clientContext.Web, web => web.Title);
clientContext.ExecuteQuery();
Response.Write(clientContext.Web.Title);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment