Class ContextUtility
Methods for connecting to SharePoint
Inheritance
System.Object
                  ContextUtility
              Inherited Members
                  System.Object.ToString()
                
                
                  System.Object.Equals(System.Object)
                
                
                  System.Object.Equals(System.Object, System.Object)
                
                
                  System.Object.ReferenceEquals(System.Object, System.Object)
                
                
                  System.Object.GetHashCode()
                
                
                  System.Object.GetType()
                
                
                  System.Object.MemberwiseClone()
                
              Namespace:AzureFunctionsForSharePoint.Core
Assembly:AzureFunctionsForSharePoint.Core.dll
Syntax
public class ContextUtility
              Methods
| Improve this Doc View SourceGetACSAccessTokens(String, String, Boolean, Boolean)
Gets an access token for a given client id and cache key combination
Declaration
public static string GetACSAccessTokens(string clientId, string cacheKey, bool appOnly = false, bool fallbackToUser = true)
              Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | clientId | The id of the client. This must match the client id from a SharePoint add-in manifest and a valid ClientConfiguration.  | 
                  
| System.String | cacheKey | A valid cache key  | 
                  
| System.Boolean | appOnly | Set to true for an app only token  | 
                  
| System.Boolean | fallbackToUser | Be the user if app only is not allowed  | 
                  
Returns
| Type | Description | 
|---|---|
| System.String | An access token string  | 
                  
GetAppOnlyAccessToken(String, String)
Declaration
public static string GetAppOnlyAccessToken(string clientId, string cacheKey)
              Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | clientId | |
| System.String | cacheKey | 
Returns
| Type | Description | 
|---|---|
| System.String | 
GetClientContext(String, String, Boolean, Boolean)
Gets a SharePoint Microsoft.SharePoint.Client.ClientContext for a given client id and cache key combination
Declaration
public static ClientContext GetClientContext(string clientId, string cacheKey, bool appOnly = false, bool fallbackToUser = true)
              Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | clientId | The id of the client. This must match the client id from a SharePoint add-in manifest and a valid ClientConfiguration.  | 
                  
| System.String | cacheKey | A valid cache key  | 
                  
| System.Boolean | appOnly | Set to true for an app only context  | 
                  
| System.Boolean | fallbackToUser | Be the user if app only is not allowed  | 
                  
Returns
| Type | Description | 
|---|---|
| Microsoft.SharePoint.Client.ClientContext | A ClientContext object  |