Class AuthenticationManager
This manager class can be used to obtain a SharePoint Client Context object
Inheritance
Namespace: PnP.Framework
Assembly: PnP.Framework.dll
Syntax
public class AuthenticationManager : IDisposable
Constructors
AuthenticationManager()
Empty constructor, to be used if you want to execute ACS based authentication methods.
Declaration
public AuthenticationManager()
AuthenticationManager(IAuthenticationProvider)
Creates an AuthenticationManager for the given PnP Core SDK
Declaration
public AuthenticationManager(IAuthenticationProvider authenticationProvider)
Parameters
IAuthentication PnP Core SDK |
AuthenticationManager(PnPContext)
Creates an AuthenticationManager for the given PnP Core SDK
Declaration
public AuthenticationManager(PnPContext pnPContext)
Parameters
Pn PnP Core SDK |
AuthenticationManager(SecureString)
Declaration
public AuthenticationManager(SecureString accessToken)
Parameters
Secure
|
AuthenticationManager(String, Action<String, Int32>, String, String, String, AzureEnvironment, Action<ITokenCache>, Boolean)
Creates a new instance of the Authentication Manager to acquire access tokens and client contexts using the Azure AD Interactive flow.
Declaration
public AuthenticationManager(string clientId, Action<string, int> openBrowserCallback, string tenantId = null, string successMessageHtml = null, string failureMessageHtml = null, AzureEnvironment azureEnvironment = default(AzureEnvironment), Action<ITokenCache> tokenCacheCallback = null, bool useWAM = false)
Parameters
System. The client id of the Azure AD application to use for authentication |
Action<System. This callback will be called providing the URL and port to open during the authentication flow |
System. Optional tenant id or tenant url |
System. Allows you to override the success message. Notice that a success header message will be added. |
System. llows you to override the failure message. Notice that a failed header message will be added and the error message will be appended. |
Azure The azure environment to use. Defaults to AzureEnvironment.Production |
Action<IToken If present, after setting up the base flow for authentication this callback will be called to register a custom tokencache. See https://aka.ms/msal-net-token-cache-serialization. |
System. If true, uses WAM for authentication. Works only on Windows OS |
AuthenticationManager(String, Func<DeviceCodeResult, Task>, AzureEnvironment, Action<ITokenCache>)
Creates a new instance of the Authentication Manager to acquire authenticated ClientContexts through device code authentication
Declaration
public AuthenticationManager(string clientId, Func<DeviceCodeResult, Task> deviceCodeCallback, AzureEnvironment azureEnvironment = default(AzureEnvironment), Action<ITokenCache> tokenCacheCallback = null)
Parameters
System. The client id of the Azure AD application to use for authentication |
Func<Device The callback that will be called with device code information. |
Azure The azure environment to use. Defaults to AzureEnvironment.Production |
Action<IToken If present, after setting up the base flow for authentication this callback will be called register a custom tokencache. See https://aka.ms/msal-net-token-cache-serialization. |
AuthenticationManager(String, StoreName, StoreLocation, String, String, String, AzureEnvironment, Action<ITokenCache>)
Creates a new instance of the Authentication Manager to acquire authenticated ClientContexts.
Declaration
public AuthenticationManager(string clientId, StoreName storeName, StoreLocation storeLocation, string thumbPrint, string tenantId, string redirectUrl = null, AzureEnvironment azureEnvironment = default(AzureEnvironment), Action<ITokenCache> tokenCacheCallback = null)
Parameters
System. The client id of the Azure AD application to use for authentication |
Store The name of the certificate store to find the certificate in. |
Store The location of the certificate store to find the certificate in. |
System. The thumbprint of the certificate to use. |
System. The tenant id (guid) or name (e.g. contoso.onmicrosoft.com) |
System. Optional redirect URL to use for authentication as set up in the Azure AD Application |
Azure The azure environment to use. Defaults to AzureEnvironment.Production |
Action<IToken If present, after setting up the base flow for authentication this callback will be called register a custom tokencache. See https://aka.ms/msal-net-token-cache-serialization. |
AuthenticationManager(String, String, Func<DeviceCodeResult, Task>, AzureEnvironment, Action<ITokenCache>)
Creates a new instance of the Authentication Manager to acquire authenticated ClientContexts through device code authentication
Declaration
public AuthenticationManager(string clientId, string tenantId, Func<DeviceCodeResult, Task> deviceCodeCallback, AzureEnvironment azureEnvironment = default(AzureEnvironment), Action<ITokenCache> tokenCacheCallback = null)
Parameters
System. The client id of the Azure AD application to use for authentication |
System. Optional tenant id or tenant url |
Func<Device The callback that will be called with device code information. |
Azure The azure environment to use. Defaults to AzureEnvironment.Production |
Action<IToken If present, after setting up the base flow for authentication this callback will be called register a custom tokencache. See https://aka.ms/msal-net-token-cache-serialization. |
AuthenticationManager(String, String, ManagedIdentityType, String)
Creates a new instance of the Authentication Manager that works with a System Assigned or User Assigned Managed Identity in Azure
Declaration
public AuthenticationManager(string endpoint, string identityHeader, ManagedIdentityType managedIdentityType = default(ManagedIdentityType), string managedIdentityUserAssignedIdentifier = null)
Parameters
System. The endpoint at which the Managed Identity Service is being hosted from which a token can be acquired |
System. Identity header available as an environment variable in Azure. Used to help mitigate server-side request forgery (SSRF) attacks. |
Managed Type of Managed Identity that should be used. Defaults to System Assigned Managed Identity. |
System. The identifier of the User Assigned Managed Identity. Can be the clientId, objectId or resourceId. Mandatory when |
AuthenticationManager(String, String, SecureString, String, AzureEnvironment, Action<ITokenCache>)
Creates a new instance of the Authentication Manager to acquire authenticated ClientContexts.
Declaration
public AuthenticationManager(string clientId, string username, SecureString password, string redirectUrl = null, AzureEnvironment azureEnvironment = default(AzureEnvironment), Action<ITokenCache> tokenCacheCallback = null)
Parameters
System. The client id of the Azure AD application to use for authentication |
System. The username to use for authentication |
Secure The password to use for authentication |
System. Optional redirect URL to use for authentication as set up in the Azure AD Application |
Azure The azure environment to use. Defaults to AzureEnvironment.Production |
Action<IToken If present, after setting up the base flow for authentication this callback will be called register a custom tokencache. See https://aka.ms/msal-net-token-cache-serialization. |
AuthenticationManager(String, String, String, AzureEnvironment, Action<ITokenCache>, ICustomWebUi, Boolean)
Creates a new instance of the Authentication Manager to acquire access tokens and client contexts using the Azure AD Interactive flow.
Declaration
public AuthenticationManager(string clientId, string redirectUrl = null, string tenantId = null, AzureEnvironment azureEnvironment = default(AzureEnvironment), Action<ITokenCache> tokenCacheCallback = null, ICustomWebUi customWebUi = null, bool useWAM = false)
Parameters
System. The client id of the Azure AD application to use for authentication |
System. Optional redirect URL to use for authentication as set up in the Azure AD Application |
System. Optional tenant id or tenant url |
Azure The azure environment to use. Defaults to AzureEnvironment.Production |
Action<IToken If present, after setting up the base flow for authentication this callback will be called register a custom tokencache. See https://aka.ms/msal-net-token-cache-serialization. |
ICustom Optional ICustomWebUi object to fully customize the feedback behavior |
System. If true, uses WAM for authentication. Works only for Windows OS platform |
AuthenticationManager(String, String, String, String, String, AzureEnvironment, Action<ITokenCache>)
Creates a new instance of the Authentication Manager to acquire authenticated ClientContexts.
Declaration
public AuthenticationManager(string clientId, string certificatePath, string certificatePassword, string tenantId, string redirectUrl = null, AzureEnvironment azureEnvironment = default(AzureEnvironment), Action<ITokenCache> tokenCacheCallback = null)
Parameters
System. The client id of the Azure AD application to use for authentication |
System. A valid path to a certificate file |
System. The password for the certificate |
System. The tenant id (guid) or name (e.g. contoso.onmicrosoft.com) |
System. Optional redirect URL to use for authentication as set up in the Azure AD Application |
Azure The azure environment to use. Defaults to AzureEnvironment.Production |
Action<IToken If present, after setting up the base flow for authentication this callback will be called register a custom tokencache. See https://aka.ms/msal-net-token-cache-serialization. |
AuthenticationManager(String, String, UserAssertion, String, AzureEnvironment, Action<ITokenCache>)
Creates a new instance of the Authentication Manager to acquire authenticated ClientContext.
Declaration
public AuthenticationManager(string clientId, string clientSecret, UserAssertion userAssertion, string tenantId = null, AzureEnvironment azureEnvironment = default(AzureEnvironment), Action<ITokenCache> tokenCacheCallback = null)
Parameters
System. The client id of the Azure AD application to use for authentication. |
System. The client secret of the Azure AD application to use for authentication. |
User The user assertion (token) of the user on whose behalf to acquire the context |
System. Optional tenant id or tenant url |
Azure The azure environment to use. Defaults to AzureEnvironment.Production |
Action<IToken
|
AuthenticationManager(String, X509Certificate2, String, String, AzureEnvironment, Action<ITokenCache>)
Creates a new instance of the Authentication Manager to acquire authenticated ClientContexts.
Declaration
public AuthenticationManager(string clientId, X509Certificate2 certificate, string tenantId, string redirectUrl = null, AzureEnvironment azureEnvironment = default(AzureEnvironment), Action<ITokenCache> tokenCacheCallback = null)
Parameters
System. The client id of the Azure AD application to use for authentication |
X509Certificate2
certificate
A valid certificate |
System. Tenant id or tenant url |
System. Optional redirect URL to use for authentication as set up in the Azure AD Application |
Azure The azure environment to use. Defaults to AzureEnvironment.Production |
Action<IToken If present, after setting up the base flow for authentication this callback will be called register a custom tokencache. See https://aka.ms/msal-net-token-cache-serialization. |
Fields
CLIENTID_SPOMANAGEMENTSHELL
The client id of the Microsoft SharePoint Online Management Shell application
Declaration
public const string CLIENTID_SPOMANAGEMENTSHELL = null
Field Value
System.
|
Properties
CookieContainer
Declaration
public CookieContainer CookieContainer { get; set; }
Property Value
Cookie
|
Methods
ClearTokenCache()
Clears the internal in-memory token cache used by MSAL
Declaration
public void ClearTokenCache()
ClearTokenCacheAsync()
Clears the internal in-memory token cache used by MSAL
Declaration
public async Task ClearTokenCacheAsync()
Returns
Task
|
CreateWithAccessToken(SecureString)
Declaration
public static AuthenticationManager CreateWithAccessToken(SecureString accessToken)
Parameters
Secure
|
Returns
CreateWithCertificate(String, StoreName, StoreLocation, String, String, String, AzureEnvironment, Action<ITokenCache>)
Creates a new instance of the Authentication Manager to acquire authenticated ClientContexts.
Declaration
public static AuthenticationManager CreateWithCertificate(string clientId, StoreName storeName, StoreLocation storeLocation, string thumbPrint, string tenantId, string redirectUrl = null, AzureEnvironment azureEnvironment = default(AzureEnvironment), Action<ITokenCache> tokenCacheCallback = null)
Parameters
System. The client id of the Azure AD application to use for authentication |
Store The name of the certificate store to find the certificate in. |
Store The location of the certificate store to find the certificate in. |
System. The thumbprint of the certificate to use. |
System. The tenant id (guid) or name (e.g. contoso.onmicrosoft.com) |
System. Optional redirect URL to use for authentication as set up in the Azure AD Application |
Azure The azure environment to use. Defaults to AzureEnvironment.Production |
Action<IToken If present, after setting up the base flow for authentication this callback will be called register a custom tokencache. See https://aka.ms/msal-net-token-cache-serialization. |
Returns
CreateWithCertificate(String, String, String, String, String, AzureEnvironment, Action<ITokenCache>)
Creates a new instance of the Authentication Manager to acquire authenticated ClientContexts.
Declaration
public static AuthenticationManager CreateWithCertificate(string clientId, string certificatePath, string certificatePassword, string tenantId, string redirectUrl = null, AzureEnvironment azureEnvironment = default(AzureEnvironment), Action<ITokenCache> tokenCacheCallback = null)
Parameters
System. The client id of the Azure AD application to use for authentication |
System. A valid path to a certificate file |
System. The password for the certificate |
System. The tenant id (guid) or name (e.g. contoso.onmicrosoft.com) |
System. Optional redirect URL to use for authentication as set up in the Azure AD Application |
Azure The azure environment to use. Defaults to AzureEnvironment.Production |
Action<IToken If present, after setting up the base flow for authentication this callback will be called register a custom tokencache. See https://aka.ms/msal-net-token-cache-serialization. |
Returns
CreateWithCertificate(String, X509Certificate2, String, String, AzureEnvironment, Action<ITokenCache>)
Creates a new instance of the Authentication Manager to acquire authenticated ClientContexts.
Declaration
public static AuthenticationManager CreateWithCertificate(string clientId, X509Certificate2 certificate, string tenantId, string redirectUrl = null, AzureEnvironment azureEnvironment = default(AzureEnvironment), Action<ITokenCache> tokenCacheCallback = null)
Parameters
System. The client id of the Azure AD application to use for authentication |
X509Certificate2
certificate
A valid certificate |
System. Tenant id or tenant url |
System. Optional redirect URL to use for authentication as set up in the Azure AD Application |
Azure The azure environment to use. Defaults to AzureEnvironment.Production |
Action<IToken If present, after setting up the base flow for authentication this callback will be called register a custom tokencache. See https://aka.ms/msal-net-token-cache-serialization. |
Returns
CreateWithCredentials(String, String, SecureString, String, AzureEnvironment, Action<ITokenCache>)
Creates a new instance of the Authentication Manager to acquire authenticated ClientContexts.
Declaration
public static AuthenticationManager CreateWithCredentials(string clientId, string username, SecureString password, string redirectUrl = null, AzureEnvironment azureEnvironment = default(AzureEnvironment), Action<ITokenCache> tokenCacheCallback = null)
Parameters
System. The client id of the Azure AD application to use for authentication |
System. The username to use for authentication |
Secure The password to use for authentication |
System. Optional redirect URL to use for authentication as set up in the Azure AD Application |
Azure The azure environment to use. Defaults to AzureEnvironment.Production |
Action<IToken If present, after setting up the base flow for authentication this callback will be called register a custom tokencache. See https://aka.ms/msal-net-token-cache-serialization. |
Returns
CreateWithDeviceLogin(String, Func<DeviceCodeResult, Task>, AzureEnvironment, Action<ITokenCache>)
Creates a new instance of the Authentication Manager to acquire authenticated ClientContexts through device code authentication
Declaration
public static AuthenticationManager CreateWithDeviceLogin(string clientId, Func<DeviceCodeResult, Task> deviceCodeCallback, AzureEnvironment azureEnvironment = default(AzureEnvironment), Action<ITokenCache> tokenCacheCallback = null)
Parameters
System. The client id of the Azure AD application to use for authentication |
Func<Device The callback that will be called with device code information. |
Azure The azure environment to use. Defaults to AzureEnvironment.Production |
Action<IToken If present, after setting up the base flow for authentication this callback will be called register a custom tokencache. See https://aka.ms/msal-net-token-cache-serialization. |
Returns
CreateWithDeviceLogin(String, String, Func<DeviceCodeResult, Task>, AzureEnvironment, Action<ITokenCache>)
Creates a new instance of the Authentication Manager to acquire authenticated ClientContexts through device code authentication
Declaration
public static AuthenticationManager CreateWithDeviceLogin(string clientId, string tenantId, Func<DeviceCodeResult, Task> deviceCodeCallback, AzureEnvironment azureEnvironment = default(AzureEnvironment), Action<ITokenCache> tokenCacheCallback = null)
Parameters
System. The client id of the Azure AD application to use for authentication |
System. Optional tenant id or tenant url |
Func<Device The callback that will be called with device code information. |
Azure The azure environment to use. Defaults to AzureEnvironment.Production |
Action<IToken If present, after setting up the base flow for authentication this callback will be called register a custom tokencache. See https://aka.ms/msal-net-token-cache-serialization. |
Returns
CreateWithInteractiveLogin(String, Action<String, Int32>, String, String, String, AzureEnvironment, Action<ITokenCache>, Boolean)
Creates a new instance of the Authentication Manager to acquire access tokens and client contexts using the Azure AD Interactive flow.
Declaration
public static AuthenticationManager CreateWithInteractiveLogin(string clientId, Action<string, int> openBrowserCallback, string tenantId = null, string successMessageHtml = null, string failureMessageHtml = null, AzureEnvironment azureEnvironment = default(AzureEnvironment), Action<ITokenCache> tokenCacheCallback = null, bool useWAM = false)
Parameters
System. The client id of the Azure AD application to use for authentication |
Action<System. This callback will be called providing the URL and port to open during the authentication flow |
System. Optional tenant id or tenant url |
System. Allows you to override the success message. Notice that a success header message will be added. |
System. llows you to override the failure message. Notice that a failed header message will be added and the error message will be appended. |
Azure The azure environment to use. Defaults to AzureEnvironment.Production |
Action<IToken If present, after setting up the base flow for authentication this callback will be called to register a custom tokencache. See https://aka.ms/msal-net-token-cache-serialization. |
System. If true, uses WAM for authentication. Works only on Windows OS. Default is false |
Returns
CreateWithInteractiveLogin(String, String, String, AzureEnvironment, Action<ITokenCache>, ICustomWebUi, Boolean)
Creates a new instance of the Authentication Manager to acquire access tokens and client contexts using the Azure AD Interactive flow.
Declaration
public static AuthenticationManager CreateWithInteractiveLogin(string clientId, string redirectUrl = null, string tenantId = null, AzureEnvironment azureEnvironment = default(AzureEnvironment), Action<ITokenCache> tokenCacheCallback = null, ICustomWebUi customWebUi = null, bool useWAM = false)
Parameters
System. The client id of the Azure AD application to use for authentication |
System. Optional redirect URL to use for authentication as set up in the Azure AD Application |
System. Optional tenant id or tenant url |
Azure The azure environment to use. Defaults to AzureEnvironment.Production |
Action<IToken If present, after setting up the base flow for authentication this callback will be called register a custom tokencache. See https://aka.ms/msal-net-token-cache-serialization. |
ICustom Optional ICustomWebUi object to fully customize the feedback behavior |
System. If true, uses WAM for authentication. Works only on Windows OS |
Returns
CreateWithInteractiveWebBrowserLogin(String, Action<String, Int32>, String, String, String, AzureEnvironment, Action<ITokenCache>, Boolean)
Creates a new instance of the Authentication Manager to acquire access tokens and client contexts using the Azure AD Interactive flow.
Declaration
public static AuthenticationManager CreateWithInteractiveWebBrowserLogin(string clientId, Action<string, int> openBrowserCallback, string tenantId = null, string successFullMessageHtml = null, string failureFullMessageHtml = null, AzureEnvironment azureEnvironment = default(AzureEnvironment), Action<ITokenCache> tokenCacheCallback = null, bool useWAM = false)
Parameters
System. The client id of the Azure AD application to use for authentication |
Action<System. This callback will be called providing the URL and port to open during the authentication flow |
System. Optional tenant id or tenant url |
System. Allows you to override the success message. You will have to provide the full HTML document. |
System. llows you to override the failure message. You will have to provide the full HTML document. |
Azure The azure environment to use. Defaults to AzureEnvironment.Production |
Action<IToken If present, after setting up the base flow for authentication this callback will be called to register a custom tokencache. See https://aka.ms/msal-net-token-cache-serialization. |
System. If true, uses WAM for authentication. Works only on Windows OS. Default is false |
Returns
CreateWithOnBehalfOf(String, String, UserAssertion, String, AzureEnvironment, Action<ITokenCache>)
Creates a new instance of the Authentication Manager to acquire authenticated ClientContext.
Declaration
public static AuthenticationManager CreateWithOnBehalfOf(string clientId, string clientSecret, UserAssertion userAssertion, string tenantId = null, AzureEnvironment azureEnvironment = default(AzureEnvironment), Action<ITokenCache> tokenCacheCallback = null)
Parameters
System. The client id of the Azure AD application to use for authentication. |
System. The client secret of the Azure AD application to use for authentication. |
User The user assertion (token) of the user on whose behalf to acquire the context |
System. Optional tenant id or tenant url |
Azure The azure environment to use. Defaults to AzureEnvironment.Production |
Action<IToken If present, after setting up the base flow for authentication this callback will be called register a custom tokencache. See https://aka.ms/msal-net-token-cache-serialization. |
Returns
CreateWithPnPCoreSdk(IAuthenticationProvider)
Creates a new instance of the Authentication Manager to acquire an authenticated ClientContext.
Declaration
public static AuthenticationManager CreateWithPnPCoreSdk(IAuthenticationProvider authenticationProvider)
Parameters
IAuthentication PnP Core SDK authentication provider that will deliver the access token |
Returns
CreateWithPnPCoreSdk(PnPContext)
Creates a new instance of the Authentication Manager to acquire an authenticated ClientContext.
Declaration
public static AuthenticationManager CreateWithPnPCoreSdk(PnPContext pnpContext)
Parameters
Pn PnP Core SDK authentication provider that will deliver the access token |
Returns
Dispose()
Dispose the object
Declaration
public void Dispose()
Dispose(Boolean)
called when disposing the object
Declaration
protected virtual void Dispose(bool disposing)
Parameters
System.
|
GetAccessToken(String, CancellationToken, Prompt)
Returns an access token for a given site.
Declaration
public string GetAccessToken(string siteUrl, CancellationToken cancellationToken, Prompt prompt = null)
Parameters
System.
|
Cancellation Optional cancellation token to cancel the request |
Prompt
prompt
The prompt style to use. Notice that this only works with the Interactive Login flow, for all other flows this parameter is ignored. |
Returns
System.
|
GetAccessToken(String, Prompt)
Returns an access token for a given site.
Declaration
public string GetAccessToken(string siteUrl, Prompt prompt = null)
Parameters
System.
|
Prompt
prompt
The prompt style to use. Notice that this only works with the Interactive Login flow, for all other flows this parameter is ignored. |
Returns
System.
|
GetAccessTokenAsync(String, CancellationToken, Prompt)
Returns an access token for a given site.
Declaration
public async Task<string> GetAccessTokenAsync(string siteUrl, CancellationToken cancellationToken, Prompt prompt = null)
Parameters
System.
|
Cancellation Optional cancellation token to cancel the request |
Prompt
prompt
The prompt style to use. Notice that this only works with the Interactive Login flow, for all other flows this parameter is ignored. |
Returns
Task<System.
|
GetAccessTokenAsync(String, Prompt)
Returns an access token for a given site.
Declaration
public async Task<string> GetAccessTokenAsync(string siteUrl, Prompt prompt = null)
Parameters
System.
|
Prompt
prompt
The prompt style to use. Notice that this only works with the Interactive Login flow, for all other flows this parameter is ignored. |
Returns
Task<System.
|
GetAccessTokenAsync(String[], CancellationToken, Prompt, Uri)
Returns an access token for the given scopes.
Declaration
public async Task<string> GetAccessTokenAsync(string[] scopes, CancellationToken cancellationToken, Prompt prompt = null, Uri uri = null)
Parameters
System. The scopes to retrieve the access token for |
Cancellation Optional cancellation token to cancel the request |
Prompt
prompt
The prompt style to use. Notice that this only works with the Interactive Login flow, for all other flows this parameter is ignored. |
Uri
uri
for ClientContextType.PnPCoreSdk case as by interface definition needed for GetAccessTokenAsync |
Returns
Task<System.
|
GetAccessTokenAsync(String[], Prompt)
Returns an access token for the given scopes.
Declaration
public async Task<string> GetAccessTokenAsync(string[] scopes, Prompt prompt = null)
Parameters
System. The scopes to retrieve the access token for |
Prompt
prompt
The prompt style to use. Notice that this only works with the Interactive Login flow, for all other flows this parameter is ignored. |
Returns
Task<System.
|
GetAccessTokenContext(String, Func<String, String>)
Returns a SharePoint ClientContext using a custom access token function. The function will be called with the Resource Uri and expected to return an access token as a string.
Declaration
public ClientContext GetAccessTokenContext(string siteUrl, Func<string, string> accessTokenGetter)
Parameters
System. Site for which the ClientContext object will be instantiated |
Func<System. The AccessToken getter method to use |
Returns
Client Client context object |
GetAccessTokenContext(String, String)
Returns a SharePoint ClientContext using custom provided access token.
Declaration
public ClientContext GetAccessTokenContext(string siteUrl, string accessToken)
Parameters
System. Site for which the ClientContext object will be instantiated |
System. An explicit value for the AccessToken |
Returns
Client Client context object |
GetACSAppOnlyContext(String, String, String)
Returns an app only ClientContext object
Declaration
public ClientContext GetACSAppOnlyContext(string siteUrl, string appId, string appSecret)
Parameters
System. Site for which the ClientContext object will be instantiated |
System. Application ID which is requesting the ClientContext object |
System. Application secret of the Application which is requesting the ClientContext object |
Returns
Client ClientContext to be used by CSOM code |
GetACSAppOnlyContext(String, String, String, AzureEnvironment)
Returns an app only ClientContext object
Declaration
public ClientContext GetACSAppOnlyContext(string siteUrl, string appId, string appSecret, AzureEnvironment environment = default(AzureEnvironment))
Parameters
System. Site for which the ClientContext object will be instantiated |
System. Application ID which is requesting the ClientContext object |
System. Application secret of the Application which is requesting the ClientContext object |
Azure SharePoint environment being used |
Returns
Client ClientContext to be used by CSOM code |
GetACSAppOnlyContext(String, String, String, String, String, String)
Returns an app only ClientContext object
Declaration
public ClientContext GetACSAppOnlyContext(string siteUrl, string realm, string appId, string appSecret, string acsHostUrl = "accesscontrol.windows.net", string globalEndPointPrefix = "accounts")
Parameters
System. Site for which the ClientContext object will be instantiated |
System. Realm of the environment (tenant) that requests the ClientContext object, may be null |
System. Application ID which is requesting the ClientContext object |
System. Application secret of the Application which is requesting the ClientContext object |
System. Azure ACS host, defaults to accesscontrol.windows.net but internal pre-production environments use other hosts |
System. Azure ACS endpoint prefix, defaults to accounts but internal pre-production environments use other prefixes |
Returns
Client ClientContext to be used by CSOM code |
GetACSEndPoint(AzureEnvironment)
Gets the Azure ASC login end point for the given environment
Declaration
public static string GetACSEndPoint(AzureEnvironment environment)
Parameters
Azure Environment to get the login information for |
Returns
System. Azure ASC login endpoint |
GetACSEndPointPrefix(AzureEnvironment)
Gets the Azure ACS login end point prefix for the given environment
Declaration
public static string GetACSEndPointPrefix(AzureEnvironment environment)
Parameters
Azure Environment to get the login information for |
Returns
System. Azure ACS login endpoint prefix |
GetAzureADLoginEndPoint(AzureEnvironment)
Gets the Azure AD login end point for the given environment
Declaration
public string GetAzureADLoginEndPoint(AzureEnvironment environment)
Parameters
Azure Environment to get the login information for |
Returns
System. Azure AD login endpoint |
GetAzureAdLoginEndPointForCustomAzureEnvironmentConfiguration()
Declaration
public string GetAzureAdLoginEndPointForCustomAzureEnvironmentConfiguration()
Returns
System.
|
GetAzureADLoginEndPointStatic(AzureEnvironment)
Declaration
public static string GetAzureADLoginEndPointStatic(AzureEnvironment environment)
Parameters
Azure
|
Returns
System.
|
GetBuilderWithAuthority(ConfidentialClientApplicationBuilder, AzureEnvironment, String)
Declaration
public ConfidentialClientApplicationBuilder GetBuilderWithAuthority(ConfidentialClientApplicationBuilder builder, AzureEnvironment azureEnvironment, string tenantId = "")
Parameters
Confidential
|
Azure
|
System.
|
Returns
Confidential
|
GetBuilderWithAuthority(PublicClientApplicationBuilder, AzureEnvironment)
Declaration
public PublicClientApplicationBuilder GetBuilderWithAuthority(PublicClientApplicationBuilder builder, AzureEnvironment azureEnvironment)
Parameters
Public
|
Azure
|
Returns
Public
|
GetContext(String)
Returns a CSOM ClientContext which has been set up for Azure AD OAuth authentication
Declaration
public ClientContext GetContext(string siteUrl)
Parameters
System.
|
Returns
Client
|
GetContext(String, CancellationToken)
Returns a CSOM ClientContext which has been set up for Azure AD OAuth authentication
Declaration
public ClientContext GetContext(string siteUrl, CancellationToken cancellationToken)
Parameters
System.
|
Cancellation Optional cancellation token to cancel the request |
Returns
Client
|
GetContextAsync(String)
Returns a CSOM ClientContext which has been set up for Azure AD OAuth authentication
Declaration
public async Task<ClientContext> GetContextAsync(string siteUrl)
Parameters
System.
|
Returns
Task<Client
|
GetContextAsync(String, CancellationToken, String, String)
Returns a CSOM ClientContext which has been set up for Azure AD OAuth authentication
Declaration
public async Task<ClientContext> GetContextAsync(string siteUrl, CancellationToken cancellationToken, string appName = "PnP", string appUrl = "https://pnp.github.io")
Parameters
System.
|
Cancellation Optional cancellation token to cancel the request |
System. Optional app name to show when using on MacOS |
System. Optional url of app to show when using on MacOS |
Returns
Task<Client
|
GetGraphBaseEndPoint()
Gets the URI to use for making Graph calls based upon the environment
Declaration
public Uri GetGraphBaseEndPoint()
Returns
Uri
Graph URI for given environment |
GetGraphBaseEndPoint(AzureEnvironment)
Gets the URI to use for making Graph calls based upon the environment
Declaration
public static Uri GetGraphBaseEndPoint(AzureEnvironment environment)
Parameters
Azure Environment to get the Graph URI for |
Returns
Uri
Graph URI for given environment |
GetGraphEndPoint()
Returns the Graph End Point url without protocol based upon the Azure Environment selected during creation of the Authentication Manager
Declaration
public string GetGraphEndPoint()
Returns
System.
|
GetGraphEndPoint(AzureEnvironment)
Returns the Graph End Point url without protocol based upon the provided Azure Environment
Declaration
public static string GetGraphEndPoint(AzureEnvironment environment)
Parameters
Azure
|
Returns
System.
|
GetGraphEndPointForCustomAzureEnvironmentConfiguration()
Declaration
public string GetGraphEndPointForCustomAzureEnvironmentConfiguration()
Returns
System.
|
GetOnPremisesContext(String)
Declaration
public ClientContext GetOnPremisesContext(string siteUrl)
Parameters
System.
|
Returns
Client
|
GetOnPremisesContext(String, ICredentials)
Declaration
public ClientContext GetOnPremisesContext(string siteUrl, ICredentials credentials)
Parameters
System.
|
ICredentials
credentials
|
Returns
Client
|
GetOnPremisesContext(String, String, SecureString)
Declaration
public ClientContext GetOnPremisesContext(string siteUrl, string userName, SecureString password)
Parameters
System.
|
System.
|
Secure
|
Returns
Client
|
GetSharePointDomainSuffix(AzureEnvironment)
GetTenantAdministrationUri(String)
Returns the equivalent SharePoint Admin url for the passed in SharePoint url
Declaration
public static Uri GetTenantAdministrationUri(string url)
Parameters
System. Any SharePoint url for the tenant you need to SharePoint Admin Center URL for |
Returns
Uri
SharePoint Admin Center URL |
GetTenantAdministrationUrl(String)
Returns the equivalent SharePoint Admin url for the passed in SharePoint url
Declaration
public static string GetTenantAdministrationUrl(string url)
Parameters
System. Any SharePoint url for the tenant you need to SharePoint Admin Center URL for |
Returns
System. SharePoint Admin Center URL |
IsTenantAdministrationUri(Uri)
Is the provided URL an SharePoint Admin center URL
Declaration
public static bool IsTenantAdministrationUri(Uri uri)
Parameters
Uri
uri
SharePoint URL to check |
Returns
System. True if Admin Center URL, false otherwise |
IsTenantAdministrationUrl(String)
Is the provided URL an SharePoint Admin center URL
Declaration
public static bool IsTenantAdministrationUrl(string url)
Parameters
System. SharePoint URL to check |
Returns
System. True if Admin Center URL, false otherwise |
SetEndPointsForCustomAzureEnvironmentConfiguration(String, String)
Declaration
public void SetEndPointsForCustomAzureEnvironmentConfiguration(string microsoftGraphEndPoint, string azureADLoginEndPoint)
Parameters
System.
|
System.
|