Class PnPContextFactory
Public factory service to create PnPContext object instances
Inheritance
Namespace: PnP.Core.Services
Assembly: PnP.Core.dll
Syntax
public class PnPContextFactory : object, IPnPContextFactory
Constructors
PnPContextFactory(ILogger<PnPContext>, SharePointRestClient, MicrosoftGraphClient, IOptions<PnPContextFactoryOptions>, IOptions<PnPGlobalSettingsOptions>, EventHub)
Properties
ContextOptions
Options used to configure this PnPContext
Declaration
protected PnPContextFactoryOptions ContextOptions { get; }
Property Value
PnPContextFactoryOptions
|
EventHub
Gets the EventHub instance, can be used to tap into events like request retry (due to throttling)
Declaration
public EventHub EventHub { get; }
Property Value
EventHub
|
Implements
GlobalOptions
Options used to configure this PnPContext
Declaration
protected PnPGlobalSettingsOptions GlobalOptions { get; }
Property Value
PnPGlobalSettingsOptions
|
Log
Connected logger
Declaration
protected ILogger Log { get; }
Property Value
ILogger
|
MicrosoftGraphClient
Connected Microsoft Graph http client
Declaration
protected MicrosoftGraphClient MicrosoftGraphClient { get; }
Property Value
MicrosoftGraphClient
|
SharePointRestClient
Methods
Create(Guid, CancellationToken, PnPContextOptions)
Creates a new instance of PnPContext based on a provided group and using the default Authentication Provider
Declaration
public virtual PnPContext Create(Guid groupId, CancellationToken cancellationToken, PnPContextOptions options = null)
Parameters
Guid
groupId
The id of an Microsoft 365 group |
CancellationToken
cancellationToken
The cancellation token to cancel operation |
PnPContextOptions
options
Options used to configure the created context |
Returns
PnPContext
A PnPContext object based on the provided configuration name |
Implements
Create(Guid, IAuthenticationProvider, CancellationToken, PnPContextOptions)
Creates a new instance of PnPContext based on a provided group and Authentication Provider instance
Declaration
public virtual PnPContext Create(Guid groupId, IAuthenticationProvider authenticationProvider, CancellationToken cancellationToken, PnPContextOptions options = null)
Parameters
Guid
groupId
The id of an Microsoft 365 group |
IAuthenticationProvider
authenticationProvider
The Authentication Provider to use to authenticate within the PnPContext |
CancellationToken
cancellationToken
The cancellation token to cancel operation |
PnPContextOptions
options
Options used to configure the created context |
Returns
PnPContext
A PnPContext object based on the provided configuration name |
Implements
Create(Guid, IAuthenticationProvider, PnPContextOptions)
Creates a new instance of PnPContext based on a provided group and Authentication Provider instance
Declaration
public virtual PnPContext Create(Guid groupId, IAuthenticationProvider authenticationProvider, PnPContextOptions options = null)
Parameters
Guid
groupId
The id of an Microsoft 365 group |
IAuthenticationProvider
authenticationProvider
The Authentication Provider to use to authenticate within the PnPContext |
PnPContextOptions
options
Options used to configure the created context |
Returns
PnPContext
A PnPContext object based on the provided configuration name |
Implements
Create(Guid, PnPContextOptions)
Creates a new instance of PnPContext based on a provided group and using the default Authentication Provider
Declaration
public virtual PnPContext Create(Guid groupId, PnPContextOptions options = null)
Parameters
Guid
groupId
The id of an Microsoft 365 group |
PnPContextOptions
options
Options used to configure the created context |
Returns
PnPContext
A PnPContext object based on the provided configuration name |
Implements
Create(String, Action<IAuthenticationProvider>, CancellationToken, PnPContextOptions)
Creates a new instance of PnPContext based on a provided configuration name
Declaration
public virtual PnPContext Create(string name, Action<IAuthenticationProvider> initializeAuthenticationProvider, CancellationToken cancellationToken, PnPContextOptions options = null)
Parameters
System.String
name
The name of the PnPContext configuration to use |
Action<IAuthenticationProvider>
initializeAuthenticationProvider
The function to initialize the authentication provider |
CancellationToken
cancellationToken
The cancellation token to cancel operation |
PnPContextOptions
options
Options used to configure the created context |
Returns
PnPContext
A PnPContext object based on the provided configuration name |
Implements
Create(String, Action<IAuthenticationProvider>, PnPContextOptions)
Creates a new instance of PnPContext based on a provided configuration name
Declaration
public virtual PnPContext Create(string name, Action<IAuthenticationProvider> initializeAuthenticationProvider, PnPContextOptions options = null)
Parameters
System.String
name
The name of the PnPContext configuration to use |
Action<IAuthenticationProvider>
initializeAuthenticationProvider
The function to initialize the authentication provider |
PnPContextOptions
options
Options used to configure the created context |
Returns
PnPContext
A PnPContext object based on the provided configuration name |
Implements
Create(String, CancellationToken, PnPContextOptions)
Creates a new instance of PnPContext based on a provided configuration name
Declaration
public virtual PnPContext Create(string name, CancellationToken cancellationToken, PnPContextOptions options = null)
Parameters
System.String
name
The name of the PnPContext configuration to use |
CancellationToken
cancellationToken
The cancellation token to cancel operation |
PnPContextOptions
options
Options used to configure the created context |
Returns
PnPContext
A PnPContext object based on the provided configuration name |
Implements
Create(String, PnPContextOptions)
Creates a new instance of PnPContext based on a provided configuration name
Declaration
public virtual PnPContext Create(string name, PnPContextOptions options = null)
Parameters
System.String
name
The name of the PnPContext configuration to use |
PnPContextOptions
options
Options used to configure the created context |
Returns
PnPContext
A PnPContext object based on the provided configuration name |
Implements
Create(Uri, CancellationToken, PnPContextOptions)
Creates a new instance of PnPContext based on a provided configuration name
Declaration
public virtual PnPContext Create(Uri url, CancellationToken cancellationToken, PnPContextOptions options = null)
Parameters
Uri
url
The URL of the PnPContext as a URI |
CancellationToken
cancellationToken
The cancellation token to cancel operation |
PnPContextOptions
options
Options used to configure the created context |
Returns
PnPContext
A PnPContext object based on the provided configuration name |
Implements
Create(Uri, IAuthenticationProvider, CancellationToken, PnPContextOptions)
Creates a new instance of PnPContext based on a provided configuration name
Declaration
public virtual PnPContext Create(Uri url, IAuthenticationProvider authenticationProvider, CancellationToken cancellationToken, PnPContextOptions options = null)
Parameters
Uri
url
The URL of the PnPContext as a URI |
IAuthenticationProvider
authenticationProvider
The Authentication Provider to use to authenticate within the PnPContext |
CancellationToken
cancellationToken
The cancellation token to cancel operation |
PnPContextOptions
options
Options used to configure the created context |
Returns
PnPContext
A PnPContext object based on the provided configuration name |
Implements
Create(Uri, IAuthenticationProvider, PnPContextOptions)
Creates a new instance of PnPContext based on a provided configuration name
Declaration
public virtual PnPContext Create(Uri url, IAuthenticationProvider authenticationProvider, PnPContextOptions options = null)
Parameters
Uri
url
The URL of the PnPContext as a URI |
IAuthenticationProvider
authenticationProvider
The Authentication Provider to use to authenticate within the PnPContext |
PnPContextOptions
options
Options used to configure the created context |
Returns
PnPContext
A PnPContext object based on the provided configuration name |
Implements
Create(Uri, PnPContextOptions)
Creates a new instance of PnPContext based on a provided configuration name
Declaration
public virtual PnPContext Create(Uri url, PnPContextOptions options = null)
Parameters
Uri
url
The URL of the PnPContext as a URI |
PnPContextOptions
options
Options used to configure the created context |
Returns
PnPContext
A PnPContext object based on the provided configuration name |
Implements
CreateAsync(Guid, CancellationToken, PnPContextOptions)
Creates a new instance of PnPContext based on a provided group and using the default Authentication Provider
Declaration
public virtual async Task<PnPContext> CreateAsync(Guid groupId, CancellationToken cancellationToken, PnPContextOptions options = null)
Parameters
Guid
groupId
The id of an Microsoft 365 group |
CancellationToken
cancellationToken
The cancellation token to cancel operation |
PnPContextOptions
options
Options used to configure the created context |
Returns
Task<PnPContext>
A PnPContext object based on the provided configuration name |
Implements
CreateAsync(Guid, IAuthenticationProvider, CancellationToken, PnPContextOptions)
Creates a new instance of PnPContext based on a provided group and Authentication Provider instance
Declaration
public virtual async Task<PnPContext> CreateAsync(Guid groupId, IAuthenticationProvider authenticationProvider, CancellationToken cancellationToken, PnPContextOptions options = null)
Parameters
Guid
groupId
The id of an Microsoft 365 group |
IAuthenticationProvider
authenticationProvider
The Authentication Provider to use to authenticate within the PnPContext |
CancellationToken
cancellationToken
The cancellation token to cancel operation |
PnPContextOptions
options
Options used to configure the created context |
Returns
Task<PnPContext>
A PnPContext object based on the provided configuration name |
Implements
CreateAsync(Guid, IAuthenticationProvider, PnPContextOptions)
Creates a new instance of PnPContext based on a provided group and Authentication Provider instance
Declaration
public virtual async Task<PnPContext> CreateAsync(Guid groupId, IAuthenticationProvider authenticationProvider, PnPContextOptions options = null)
Parameters
Guid
groupId
The id of an Microsoft 365 group |
IAuthenticationProvider
authenticationProvider
The Authentication Provider to use to authenticate within the PnPContext |
PnPContextOptions
options
Options used to configure the created context |
Returns
Task<PnPContext>
A PnPContext object based on the provided configuration name |
Implements
CreateAsync(Guid, PnPContextOptions)
Creates a new instance of PnPContext based on a provided group and using the default Authentication Provider
Declaration
public virtual async Task<PnPContext> CreateAsync(Guid groupId, PnPContextOptions options = null)
Parameters
Guid
groupId
The id of an Microsoft 365 group |
PnPContextOptions
options
Options used to configure the created context |
Returns
Task<PnPContext>
A PnPContext object based on the provided configuration name |
Implements
CreateAsync(String, Action<IAuthenticationProvider>, CancellationToken, PnPContextOptions)
Creates a new instance of PnPContext based on a provided configuration name
Declaration
public virtual async Task<PnPContext> CreateAsync(string name, Action<IAuthenticationProvider> initializeAuthenticationProvider, CancellationToken cancellationToken, PnPContextOptions options = null)
Parameters
System.String
name
The name of the PnPContext configuration to use |
Action<IAuthenticationProvider>
initializeAuthenticationProvider
The function to initialize the authentication provider |
CancellationToken
cancellationToken
The cancellation token to cancel operation |
PnPContextOptions
options
Options used to configure the created context |
Returns
Task<PnPContext>
A PnPContext object based on the provided configuration name |
Implements
CreateAsync(String, Action<IAuthenticationProvider>, PnPContextOptions)
Creates a new instance of PnPContext based on a provided configuration name
Declaration
public virtual async Task<PnPContext> CreateAsync(string name, Action<IAuthenticationProvider> initializeAuthenticationProvider, PnPContextOptions options = null)
Parameters
System.String
name
The name of the PnPContext configuration to use |
Action<IAuthenticationProvider>
initializeAuthenticationProvider
The function to initialize the authentication provider |
PnPContextOptions
options
Options used to configure the created context |
Returns
Task<PnPContext>
A PnPContext object based on the provided configuration name |
Implements
CreateAsync(String, CancellationToken, PnPContextOptions)
Creates a new instance of PnPContext based on a provided configuration name
Declaration
public virtual async Task<PnPContext> CreateAsync(string name, CancellationToken cancellationToken, PnPContextOptions options = null)
Parameters
System.String
name
The name of the PnPContext configuration to use |
CancellationToken
cancellationToken
The cancellation token to cancel operation |
PnPContextOptions
options
Options used to configure the created context |
Returns
Task<PnPContext>
A PnPContext object based on the provided configuration name |
Implements
CreateAsync(String, PnPContextOptions)
Creates a new instance of PnPContext based on a provided configuration name
Declaration
public virtual async Task<PnPContext> CreateAsync(string name, PnPContextOptions options = null)
Parameters
System.String
name
The name of the PnPContext configuration to use |
PnPContextOptions
options
Options used to configure the created context |
Returns
Task<PnPContext>
A PnPContext object based on the provided configuration name |
Implements
CreateAsync(Uri, CancellationToken, PnPContextOptions)
Creates a new instance of PnPContext based on a provided configuration name
Declaration
public virtual async Task<PnPContext> CreateAsync(Uri url, CancellationToken cancellationToken, PnPContextOptions options = null)
Parameters
Uri
url
The URL of the PnPContext as a URI |
CancellationToken
cancellationToken
The cancellation token to cancel operation |
PnPContextOptions
options
Options used to configure the created context |
Returns
Task<PnPContext>
A PnPContext object based on the provided configuration name |
Implements
CreateAsync(Uri, IAuthenticationProvider, CancellationToken, PnPContextOptions)
Creates a new instance of PnPContext based on a provided configuration name
Declaration
public virtual async Task<PnPContext> CreateAsync(Uri url, IAuthenticationProvider authenticationProvider, CancellationToken cancellationToken, PnPContextOptions options = null)
Parameters
Uri
url
The URL of the PnPContext as a URI |
IAuthenticationProvider
authenticationProvider
The Authentication Provider to use to authenticate within the PnPContext |
CancellationToken
cancellationToken
The cancellation token to cancel operation |
PnPContextOptions
options
Options used to configure the created context |
Returns
Task<PnPContext>
A PnPContext object based on the provided configuration name |
Implements
CreateAsync(Uri, IAuthenticationProvider, PnPContextOptions)
Creates a new instance of PnPContext based on a provided configuration name
Declaration
public virtual async Task<PnPContext> CreateAsync(Uri url, IAuthenticationProvider authenticationProvider, PnPContextOptions options = null)
Parameters
Uri
url
The URL of the PnPContext as a URI |
IAuthenticationProvider
authenticationProvider
The Authentication Provider to use to authenticate within the PnPContext |
PnPContextOptions
options
Options used to configure the created context |
Returns
Task<PnPContext>
A PnPContext object based on the provided configuration name |
Implements
CreateAsync(Uri, PnPContextOptions)
Creates a new instance of PnPContext based on a provided configuration name
Declaration
public virtual async Task<PnPContext> CreateAsync(Uri url, PnPContextOptions options = null)
Parameters
Uri
url
The URL of the PnPContext as a URI |
PnPContextOptions
options
Options used to configure the created context |
Returns
Task<PnPContext>
A PnPContext object based on the provided configuration name |