Class PnPContextFactory
Public factory service to create PnPContext object instances
public class PnPContextFactory : IPnPContextFactory
- Inheritance
-
PnPContextFactory
- Implements
- Inherited Members
Constructors
PnPContextFactory(ILogger<PnPContext>, SharePointRestClient, MicrosoftGraphClient, IOptions<PnPContextFactoryOptions>, IOptions<PnPGlobalSettingsOptions>, EventHub)
Default constructor for PnPContextFactory
public PnPContextFactory(ILogger<PnPContext> logger, SharePointRestClient sharePointRestClient, MicrosoftGraphClient microsoftGraphClient, IOptions<PnPContextFactoryOptions> contextOptions, IOptions<PnPGlobalSettingsOptions> globalOptions, EventHub eventHub)
Parameters
loggerILogger<PnPContext>Connected logger
sharePointRestClientSharePointRestClientSharePoint REST http client to use
microsoftGraphClientMicrosoftGraphClientMicrosoft Graph http client to use
contextOptionsIOptions<PnPContextFactoryOptions>PnPContextFactory options
globalOptionsIOptions<PnPGlobalSettingsOptions>Global options to use
eventHubEventHubEventHub instance
Properties
ContextOptions
Options used to configure this PnPContext
protected PnPContextFactoryOptions ContextOptions { get; }
Property Value
EventHub
Gets the EventHub instance, can be used to tap into events like request retry (due to throttling)
public EventHub EventHub { get; }
Property Value
GlobalOptions
Options used to configure this PnPContext
protected PnPGlobalSettingsOptions GlobalOptions { get; }
Property Value
Log
Connected logger
protected ILogger Log { get; }
Property Value
MicrosoftGraphClient
Connected Microsoft Graph http client
protected MicrosoftGraphClient MicrosoftGraphClient { get; }
Property Value
SharePointRestClient
Connected SharePoint REST http client
protected SharePointRestClient SharePointRestClient { get; }
Property Value
Methods
Create(Guid, IAuthenticationProvider, PnPContextOptions)
Creates a new instance of PnPContext based on a provided group and Authentication Provider instance
public virtual PnPContext Create(Guid groupId, IAuthenticationProvider authenticationProvider, PnPContextOptions options = null)
Parameters
groupIdGuidThe id of an Microsoft 365 group
authenticationProviderIAuthenticationProviderThe Authentication Provider to use to authenticate within the PnPContext
optionsPnPContextOptionsOptions used to configure the created context
Returns
- PnPContext
A PnPContext object based on the provided configuration name
Create(Guid, IAuthenticationProvider, CancellationToken, PnPContextOptions)
Creates a new instance of PnPContext based on a provided group and Authentication Provider instance
public virtual PnPContext Create(Guid groupId, IAuthenticationProvider authenticationProvider, CancellationToken cancellationToken, PnPContextOptions options = null)
Parameters
groupIdGuidThe id of an Microsoft 365 group
authenticationProviderIAuthenticationProviderThe Authentication Provider to use to authenticate within the PnPContext
cancellationTokenCancellationTokenThe cancellation token to cancel operation
optionsPnPContextOptionsOptions used to configure the created context
Returns
- PnPContext
A PnPContext object based on the provided configuration name
Create(Guid, PnPContextOptions)
Creates a new instance of PnPContext based on a provided group and using the default Authentication Provider
public virtual PnPContext Create(Guid groupId, PnPContextOptions options = null)
Parameters
groupIdGuidThe id of an Microsoft 365 group
optionsPnPContextOptionsOptions used to configure the created context
Returns
- PnPContext
A PnPContext object based on the provided configuration name
Create(Guid, CancellationToken, PnPContextOptions)
Creates a new instance of PnPContext based on a provided group and using the default Authentication Provider
public virtual PnPContext Create(Guid groupId, CancellationToken cancellationToken, PnPContextOptions options = null)
Parameters
groupIdGuidThe id of an Microsoft 365 group
cancellationTokenCancellationTokenThe cancellation token to cancel operation
optionsPnPContextOptionsOptions used to configure the created context
Returns
- PnPContext
A PnPContext object based on the provided configuration name
Create(string, PnPContextOptions)
Creates a new instance of PnPContext based on a provided configuration name
public virtual PnPContext Create(string name, PnPContextOptions options = null)
Parameters
namestringThe name of the PnPContext configuration to use
optionsPnPContextOptionsOptions used to configure the created context
Returns
- PnPContext
A PnPContext object based on the provided configuration name
Create(string, Action<IAuthenticationProvider>, PnPContextOptions)
Creates a new instance of PnPContext based on a provided configuration name
public virtual PnPContext Create(string name, Action<IAuthenticationProvider> initializeAuthenticationProvider, PnPContextOptions options = null)
Parameters
namestringThe name of the PnPContext configuration to use
initializeAuthenticationProviderAction<IAuthenticationProvider>The function to initialize the authentication provider
optionsPnPContextOptionsOptions used to configure the created context
Returns
- PnPContext
A PnPContext object based on the provided configuration name
Create(string, Action<IAuthenticationProvider>, CancellationToken, PnPContextOptions)
Creates a new instance of PnPContext based on a provided configuration name
public virtual PnPContext Create(string name, Action<IAuthenticationProvider> initializeAuthenticationProvider, CancellationToken cancellationToken, PnPContextOptions options = null)
Parameters
namestringThe name of the PnPContext configuration to use
initializeAuthenticationProviderAction<IAuthenticationProvider>The function to initialize the authentication provider
cancellationTokenCancellationTokenThe cancellation token to cancel operation
optionsPnPContextOptionsOptions used to configure the created context
Returns
- PnPContext
A PnPContext object based on the provided configuration name
Create(string, CancellationToken, PnPContextOptions)
Creates a new instance of PnPContext based on a provided configuration name
public virtual PnPContext Create(string name, CancellationToken cancellationToken, PnPContextOptions options = null)
Parameters
namestringThe name of the PnPContext configuration to use
cancellationTokenCancellationTokenThe cancellation token to cancel operation
optionsPnPContextOptionsOptions used to configure the created context
Returns
- PnPContext
A PnPContext object based on the provided configuration name
Create(Uri, IAuthenticationProvider, PnPContextOptions)
Creates a new instance of PnPContext based on a provided configuration name
public virtual PnPContext Create(Uri url, IAuthenticationProvider authenticationProvider, PnPContextOptions options = null)
Parameters
urlUriThe URL of the PnPContext as a URI
authenticationProviderIAuthenticationProviderThe Authentication Provider to use to authenticate within the PnPContext
optionsPnPContextOptionsOptions used to configure the created context
Returns
- PnPContext
A PnPContext object based on the provided configuration name
Create(Uri, IAuthenticationProvider, CancellationToken, PnPContextOptions)
Creates a new instance of PnPContext based on a provided configuration name
public virtual PnPContext Create(Uri url, IAuthenticationProvider authenticationProvider, CancellationToken cancellationToken, PnPContextOptions options = null)
Parameters
urlUriThe URL of the PnPContext as a URI
authenticationProviderIAuthenticationProviderThe Authentication Provider to use to authenticate within the PnPContext
cancellationTokenCancellationTokenThe cancellation token to cancel operation
optionsPnPContextOptionsOptions used to configure the created context
Returns
- PnPContext
A PnPContext object based on the provided configuration name
Create(Uri, PnPContextOptions)
Creates a new instance of PnPContext based on a provided configuration name
public virtual PnPContext Create(Uri url, PnPContextOptions options = null)
Parameters
urlUriThe URL of the PnPContext as a URI
optionsPnPContextOptionsOptions used to configure the created context
Returns
- PnPContext
A PnPContext object based on the provided configuration name
Create(Uri, CancellationToken, PnPContextOptions)
Creates a new instance of PnPContext based on a provided configuration name
public virtual PnPContext Create(Uri url, CancellationToken cancellationToken, PnPContextOptions options = null)
Parameters
urlUriThe URL of the PnPContext as a URI
cancellationTokenCancellationTokenThe cancellation token to cancel operation
optionsPnPContextOptionsOptions used to configure the created context
Returns
- PnPContext
A PnPContext object based on the provided configuration name
CreateAsync(Guid, IAuthenticationProvider, PnPContextOptions)
Creates a new instance of PnPContext based on a provided group and Authentication Provider instance
public virtual Task<PnPContext> CreateAsync(Guid groupId, IAuthenticationProvider authenticationProvider, PnPContextOptions options = null)
Parameters
groupIdGuidThe id of an Microsoft 365 group
authenticationProviderIAuthenticationProviderThe Authentication Provider to use to authenticate within the PnPContext
optionsPnPContextOptionsOptions used to configure the created context
Returns
- Task<PnPContext>
A PnPContext object based on the provided configuration name
CreateAsync(Guid, IAuthenticationProvider, CancellationToken, PnPContextOptions)
Creates a new instance of PnPContext based on a provided group and Authentication Provider instance
public virtual Task<PnPContext> CreateAsync(Guid groupId, IAuthenticationProvider authenticationProvider, CancellationToken cancellationToken, PnPContextOptions options = null)
Parameters
groupIdGuidThe id of an Microsoft 365 group
authenticationProviderIAuthenticationProviderThe Authentication Provider to use to authenticate within the PnPContext
cancellationTokenCancellationTokenThe cancellation token to cancel operation
optionsPnPContextOptionsOptions used to configure the created context
Returns
- Task<PnPContext>
A PnPContext object based on the provided configuration name
CreateAsync(Guid, PnPContextOptions)
Creates a new instance of PnPContext based on a provided group and using the default Authentication Provider
public virtual Task<PnPContext> CreateAsync(Guid groupId, PnPContextOptions options = null)
Parameters
groupIdGuidThe id of an Microsoft 365 group
optionsPnPContextOptionsOptions used to configure the created context
Returns
- Task<PnPContext>
A PnPContext object based on the provided configuration name
CreateAsync(Guid, CancellationToken, PnPContextOptions)
Creates a new instance of PnPContext based on a provided group and using the default Authentication Provider
public virtual Task<PnPContext> CreateAsync(Guid groupId, CancellationToken cancellationToken, PnPContextOptions options = null)
Parameters
groupIdGuidThe id of an Microsoft 365 group
cancellationTokenCancellationTokenThe cancellation token to cancel operation
optionsPnPContextOptionsOptions used to configure the created context
Returns
- Task<PnPContext>
A PnPContext object based on the provided configuration name
CreateAsync(string, PnPContextOptions)
Creates a new instance of PnPContext based on a provided configuration name
public virtual Task<PnPContext> CreateAsync(string name, PnPContextOptions options = null)
Parameters
namestringThe name of the PnPContext configuration to use
optionsPnPContextOptionsOptions used to configure the created context
Returns
- Task<PnPContext>
A PnPContext object based on the provided configuration name
CreateAsync(string, Action<IAuthenticationProvider>, PnPContextOptions)
Creates a new instance of PnPContext based on a provided configuration name
public virtual Task<PnPContext> CreateAsync(string name, Action<IAuthenticationProvider> initializeAuthenticationProvider, PnPContextOptions options = null)
Parameters
namestringThe name of the PnPContext configuration to use
initializeAuthenticationProviderAction<IAuthenticationProvider>The function to initialize the authentication provider
optionsPnPContextOptionsOptions used to configure the created context
Returns
- Task<PnPContext>
A PnPContext object based on the provided configuration name
CreateAsync(string, Action<IAuthenticationProvider>, CancellationToken, PnPContextOptions)
Creates a new instance of PnPContext based on a provided configuration name
public virtual Task<PnPContext> CreateAsync(string name, Action<IAuthenticationProvider> initializeAuthenticationProvider, CancellationToken cancellationToken, PnPContextOptions options = null)
Parameters
namestringThe name of the PnPContext configuration to use
initializeAuthenticationProviderAction<IAuthenticationProvider>The function to initialize the authentication provider
cancellationTokenCancellationTokenThe cancellation token to cancel operation
optionsPnPContextOptionsOptions used to configure the created context
Returns
- Task<PnPContext>
A PnPContext object based on the provided configuration name
CreateAsync(string, CancellationToken, PnPContextOptions)
Creates a new instance of PnPContext based on a provided configuration name
public virtual Task<PnPContext> CreateAsync(string name, CancellationToken cancellationToken, PnPContextOptions options = null)
Parameters
namestringThe name of the PnPContext configuration to use
cancellationTokenCancellationTokenThe cancellation token to cancel operation
optionsPnPContextOptionsOptions used to configure the created context
Returns
- Task<PnPContext>
A PnPContext object based on the provided configuration name
CreateAsync(Uri, IAuthenticationProvider, PnPContextOptions)
Creates a new instance of PnPContext based on a provided configuration name
public virtual Task<PnPContext> CreateAsync(Uri url, IAuthenticationProvider authenticationProvider, PnPContextOptions options = null)
Parameters
urlUriThe URL of the PnPContext as a URI
authenticationProviderIAuthenticationProviderThe Authentication Provider to use to authenticate within the PnPContext
optionsPnPContextOptionsOptions used to configure the created context
Returns
- Task<PnPContext>
A PnPContext object based on the provided configuration name
CreateAsync(Uri, IAuthenticationProvider, CancellationToken, PnPContextOptions)
Creates a new instance of PnPContext based on a provided configuration name
public virtual Task<PnPContext> CreateAsync(Uri url, IAuthenticationProvider authenticationProvider, CancellationToken cancellationToken, PnPContextOptions options = null)
Parameters
urlUriThe URL of the PnPContext as a URI
authenticationProviderIAuthenticationProviderThe Authentication Provider to use to authenticate within the PnPContext
cancellationTokenCancellationTokenThe cancellation token to cancel operation
optionsPnPContextOptionsOptions used to configure the created context
Returns
- Task<PnPContext>
A PnPContext object based on the provided configuration name
CreateAsync(Uri, PnPContextOptions)
Creates a new instance of PnPContext based on a provided configuration name
public virtual Task<PnPContext> CreateAsync(Uri url, PnPContextOptions options = null)
Parameters
urlUriThe URL of the PnPContext as a URI
optionsPnPContextOptionsOptions used to configure the created context
Returns
- Task<PnPContext>
A PnPContext object based on the provided configuration name
CreateAsync(Uri, CancellationToken, PnPContextOptions)
Creates a new instance of PnPContext based on a provided configuration name
public virtual Task<PnPContext> CreateAsync(Uri url, CancellationToken cancellationToken, PnPContextOptions options = null)
Parameters
urlUriThe URL of the PnPContext as a URI
cancellationTokenCancellationTokenThe cancellation token to cancel operation
optionsPnPContextOptionsOptions used to configure the created context
Returns
- Task<PnPContext>
A PnPContext object based on the provided configuration name