Search Results for

    Show / Hide Table of Contents

    Class PnPContextFactory

    Public factory service to create PnPContext object instances

    Inheritance
    System.Object
    PnPContextFactory
    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)

    Default constructor for PnPContextFactory

    Declaration
    public PnPContextFactory(ILogger<PnPContext> logger, SharePointRestClient sharePointRestClient, MicrosoftGraphClient microsoftGraphClient, IOptions<PnPContextFactoryOptions> contextOptions, IOptions<PnPGlobalSettingsOptions> globalOptions, EventHub eventHub)
    Parameters
    ILogger<PnPContext> logger

    Connected logger

    SharePointRestClient sharePointRestClient

    SharePoint REST http client to use

    MicrosoftGraphClient microsoftGraphClient

    Microsoft Graph http client to use

    IOptions<PnPContextFactoryOptions> contextOptions

    PnPContextFactory options

    IOptions<PnPGlobalSettingsOptions> globalOptions

    Global options to use

    EventHub eventHub

    EventHub instance

    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
    IPnPContextFactory.EventHub

    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

    Connected SharePoint REST http client

    Declaration
    protected SharePointRestClient SharePointRestClient { get; }
    Property Value
    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
    IPnPContextFactory.Create(Guid, CancellationToken, PnPContextOptions)

    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
    IPnPContextFactory.Create(Guid, IAuthenticationProvider, CancellationToken, PnPContextOptions)

    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
    IPnPContextFactory.Create(Guid, IAuthenticationProvider, PnPContextOptions)

    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
    IPnPContextFactory.Create(Guid, PnPContextOptions)

    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
    IPnPContextFactory.Create(String, Action<IAuthenticationProvider>, CancellationToken, PnPContextOptions)

    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
    IPnPContextFactory.Create(String, Action<IAuthenticationProvider>, PnPContextOptions)

    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
    IPnPContextFactory.Create(String, CancellationToken, PnPContextOptions)

    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
    IPnPContextFactory.Create(String, PnPContextOptions)

    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
    IPnPContextFactory.Create(Uri, CancellationToken, PnPContextOptions)

    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
    IPnPContextFactory.Create(Uri, IAuthenticationProvider, CancellationToken, PnPContextOptions)

    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
    IPnPContextFactory.Create(Uri, IAuthenticationProvider, PnPContextOptions)

    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
    IPnPContextFactory.Create(Uri, PnPContextOptions)

    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
    IPnPContextFactory.CreateAsync(Guid, CancellationToken, PnPContextOptions)

    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
    IPnPContextFactory.CreateAsync(Guid, IAuthenticationProvider, CancellationToken, PnPContextOptions)

    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
    IPnPContextFactory.CreateAsync(Guid, IAuthenticationProvider, PnPContextOptions)

    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
    IPnPContextFactory.CreateAsync(Guid, PnPContextOptions)

    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
    IPnPContextFactory.CreateAsync(String, Action<IAuthenticationProvider>, CancellationToken, PnPContextOptions)

    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
    IPnPContextFactory.CreateAsync(String, Action<IAuthenticationProvider>, PnPContextOptions)

    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
    IPnPContextFactory.CreateAsync(String, CancellationToken, PnPContextOptions)

    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
    IPnPContextFactory.CreateAsync(String, PnPContextOptions)

    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
    IPnPContextFactory.CreateAsync(Uri, CancellationToken, PnPContextOptions)

    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
    IPnPContextFactory.CreateAsync(Uri, IAuthenticationProvider, CancellationToken, PnPContextOptions)

    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
    IPnPContextFactory.CreateAsync(Uri, IAuthenticationProvider, PnPContextOptions)

    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

    Implements
    IPnPContextFactory.CreateAsync(Uri, PnPContextOptions)
    Back to top PnP Core SDK
    Generated by DocFX with Material UI
    spacer