2017-02-17 21 views

ответ

0

Если вы можете использовать его в приложении SharePoint, попробуйте вот так.

string realm = TokenHelper.GetRealmFromTargetUrl(siteUri); 

//Get the access token for the URL. 
//Requires this app to be registered with the tenant 
string accessToken = TokenHelper.GetAppOnlyAccessToken(
    TokenHelper.SharePointPrincipal, 
    siteUri.Authority, 
    realm).AccessToken; 

//Get client context with access token 
using(var clientContext = TokenHelper.GetClientContextWithAccessToken(
    siteUri.ToString(),accessToken)) 
{ 
    //Do work here 
} 

Ссылки: https://blogs.msdn.microsoft.com/kaevans/2013/10/24/what-every-developer-needs-to-know-about-sharepoint-apps-csom-and-anonymous-publishing-sites/

лексем Helper: https://github.com/OfficeDev/SharePoint-Add-in-CSOM-BasicDataOperations/blob/master/SharePoint-Add-in-CSOM-BasicDataOperationsWeb/TokenHelper.cs

 Смежные вопросы

  • Нет связанных вопросов^_^