internal static async Task <Office365ServiceInfo> CreateAsync(string resourceId, string apiEndpoint) { Office365ServiceInfo info = new SharePointServiceInfo() { ResourceId = resourceId, ApiEndpoint = apiEndpoint }; info.AccessToken = await Office365Helper.GetAccessToken(info.ResourceId); return(info); }
/// <summary> /// Returns information about a SharePoint service for a particular Resource ID and API Endpoint, /// including its cached access token. /// For example, to access a list called "MyList" at the root of a SharePoint site, /// the Resource ID would be "https://{tenant-name}.sharepoint.com/", /// the API Endpoint would be "https://{tenant-name}.sharepoint.com/_api", /// and the list could be accessed by using ApiEndpoint + "/web/lists/getbytitle('MyList')". /// On error, this method will display an error message to the user, and return an /// Office365ServiceInfo instance whose HasValidAccessToken property is set to "false". /// </summary> public static async Task <Office365ServiceInfo> GetSharePointServiceInfoAsync(string resourceId, string apiEndpoint) { return(await SharePointServiceInfo.CreateAsync(resourceId, apiEndpoint)); }