Search Results for

    Show / Hide Table of Contents

    Class PnPContext

    PnP Context class...the glue between the model and the data stores

    Inheritance
    System.Object
    PnPContext
    Namespace: PnP.Core.Services
    Assembly: PnP.Core.dll
    Syntax
    public class PnPContext : object, IPnPContext

    Properties

    AuthenticationProvider

    Connected authentication provider

    Declaration
    public IAuthenticationProvider AuthenticationProvider { get; }
    Property Value
    IAuthenticationProvider

    Implements
    IPnPContext.AuthenticationProvider

    AzureADLoginAuthority

    Returns the Azure AD Login authority (e.g. login.microsoftonline.com) to use when Environment is set to Custom

    Declaration
    public string AzureADLoginAuthority { get; }
    Property Value
    System.String

    Implements
    IPnPContext.AzureADLoginAuthority

    ContentTypeHub

    Entry point for the ContentTypeHub object

    Declaration
    public IContentTypeHub ContentTypeHub { get; }
    Property Value
    IContentTypeHub

    Implements
    IPnPContext.ContentTypeHub

    CurrentBatch

    Current batch, used for implicit batching

    Declaration
    public Batch CurrentBatch { get; }
    Property Value
    Batch

    Implements
    IPnPContext.CurrentBatch

    Environment

    Returns the used Microsoft 365 cloud environment

    Declaration
    public Microsoft365Environment? Environment { get; }
    Property Value
    System.Nullable<Microsoft365Environment>

    Implements
    IPnPContext.Environment

    GraphAlwaysUseBeta

    If true than all requests to Microsoft Graph use the beta endpoint

    Declaration
    public bool GraphAlwaysUseBeta { get; set; }
    Property Value
    System.Boolean

    Implements
    IPnPContext.GraphAlwaysUseBeta

    GraphCanUseBeta

    If true than the Graph beta endpoint is used when there's no other option, default approach stays using the v1 endpoint

    Declaration
    public bool GraphCanUseBeta { get; set; }
    Property Value
    System.Boolean

    Implements
    IPnPContext.GraphCanUseBeta

    GraphClient

    Connected Microsoft Graph client

    Declaration
    public MicrosoftGraphClient GraphClient { get; }
    Property Value
    MicrosoftGraphClient

    Implements
    IPnPContext.GraphClient

    GraphFirst

    Controls whether the library will try to use Microsoft Graph over REST whenever that's defined in the model

    Declaration
    public bool GraphFirst { get; set; }
    Property Value
    System.Boolean

    Implements
    IPnPContext.GraphFirst

    Group

    Entry point for the Microsoft 365 Group Object

    Declaration
    public IGraphGroup Group { get; }
    Property Value
    IGraphGroup

    Implements
    IPnPContext.Group

    HasPendingRequests

    Are there pending requests to execute (in the case of batching)

    Declaration
    public bool HasPendingRequests { get; }
    Property Value
    System.Boolean

    Implements
    IPnPContext.HasPendingRequests

    Logger

    Connected logger

    Declaration
    public ILogger Logger { get; }
    Property Value
    ILogger

    Implements
    IPnPContext.Logger

    Me

    Entry point for the Me object

    Declaration
    public IMe Me { get; }
    Property Value
    IMe

    Implements
    IPnPContext.Me

    MicrosoftGraphAuthority

    Returns the Microsoft Graph authority (e.g. graph.microsoft.com) to use when Environment is set to Custom

    Declaration
    public string MicrosoftGraphAuthority { get; }
    Property Value
    System.String

    Implements
    IPnPContext.MicrosoftGraphAuthority

    Properties

    Collection for custom properties that you want to attach to a PnPContext

    Declaration
    public IDictionary<string, object> Properties { get; }
    Property Value
    IDictionary<System.String, System.Object>

    Implements
    IPnPContext.Properties

    RestClient

    Connected SharePoint REST client

    Declaration
    public SharePointRestClient RestClient { get; }
    Property Value
    SharePointRestClient

    Implements
    IPnPContext.RestClient

    Site

    Entry point for the Site Object

    Declaration
    public ISite Site { get; }
    Property Value
    ISite

    Implements
    IPnPContext.Site

    Social

    Entry point for the social-related APIs

    Declaration
    public ISocial Social { get; }
    Property Value
    ISocial

    Implements
    IPnPContext.Social

    Team

    Entry point for the Team Object

    Declaration
    public ITeam Team { get; }
    Property Value
    ITeam

    Implements
    IPnPContext.Team

    TermStore

    Entry point for the Microsoft 365 TermStore

    Declaration
    public ITermStore TermStore { get; }
    Property Value
    ITermStore

    Implements
    IPnPContext.TermStore

    Uri

    Uri of the SharePoint site we're working against

    Declaration
    public Uri Uri { get; }
    Property Value
    Uri

    Implements
    IPnPContext.Uri

    Web

    Entry point for the Web Object

    Declaration
    public IWeb Web { get; }
    Property Value
    IWeb

    Implements
    IPnPContext.Web

    Methods

    Clone()

    Clones this context into a new context for the same SharePoint site

    Declaration
    public PnPContext Clone()
    Returns
    PnPContext

    New PnPContext

    Implements
    IPnPContext.Clone()

    Clone(Guid)

    Clones this context for another SharePoint site

    Declaration
    public PnPContext Clone(Guid groupId)
    Parameters
    Guid groupId

    Id of the other Microsoft 365 group to create a PnPContext for

    Returns
    PnPContext

    New PnPContext

    Implements
    IPnPContext.Clone(Guid)

    Clone(String)

    Clones this context for another SharePoint site provided as configuration

    Declaration
    public PnPContext Clone(string name)
    Parameters
    System.String name

    The name of the SPOContext configuration to use

    Returns
    PnPContext

    New PnPContext for the request config

    Implements
    IPnPContext.Clone(String)

    Clone(Uri)

    Clones this context for another SharePoint site

    Declaration
    public PnPContext Clone(Uri uri)
    Parameters
    Uri uri

    Uri of the other SharePoint site

    Returns
    PnPContext

    New PnPContext

    Implements
    IPnPContext.Clone(Uri)

    CloneAsync()

    Clones this context into a new context for the same SharePoint site

    Declaration
    public async Task<PnPContext> CloneAsync()
    Returns
    Task<PnPContext>

    New PnPContext

    Implements
    IPnPContext.CloneAsync()

    CloneAsync(Guid)

    Clones this context for another SharePoint site

    Declaration
    public async Task<PnPContext> CloneAsync(Guid groupId)
    Parameters
    Guid groupId

    Id of the other Microsoft 365 group to create a PnPContext for

    Returns
    Task<PnPContext>

    New PnPContext

    Implements
    IPnPContext.CloneAsync(Guid)

    CloneAsync(String)

    Clones this context for another SharePoint site provided as configuration

    Declaration
    public async Task<PnPContext> CloneAsync(string name)
    Parameters
    System.String name

    The name of the SPOContext configuration to use

    Returns
    Task<PnPContext>

    New PnPContext for the request config

    Implements
    IPnPContext.CloneAsync(String)

    CloneAsync(Uri)

    Clones this context for another SharePoint site

    Declaration
    public async Task<PnPContext> CloneAsync(Uri uri)
    Parameters
    Uri uri

    Uri of the other SharePoint site

    Returns
    Task<PnPContext>

    New PnPContext

    Implements
    IPnPContext.CloneAsync(Uri)

    Dispose()

    Disposes this PnPContext

    Declaration
    public void Dispose()

    Dispose(Boolean)

    Disposes this PnPContext

    Declaration
    protected virtual void Dispose(bool disposing)
    Parameters
    System.Boolean disposing

    Do we need to dispose resources

    Execute(Batch, Boolean)

    Method to execute a given batch

    Declaration
    public List<BatchResult> Execute(Batch batch, bool throwOnError = true)
    Parameters
    Batch batch

    Batch to execute

    System.Boolean throwOnError

    Throw an exception on the first encountered error in the batch

    Returns
    PnP.Core.Model.SharePoint.List<BatchResult>

    The asynchronous task that will be executed

    Implements
    IPnPContext.Execute(Batch, Boolean)

    Execute(Boolean)

    Method to execute the current batch

    Declaration
    public List<BatchResult> Execute(bool throwOnError = true)
    Parameters
    System.Boolean throwOnError

    Throw an exception on the first encountered error in the batch

    Returns
    PnP.Core.Model.SharePoint.List<BatchResult>

    The asynchronous task that will be executed

    Implements
    IPnPContext.Execute(Boolean)

    ExecuteAsync(Batch, Boolean)

    Method to execute a given batch

    Declaration
    public async Task<List<BatchResult>> ExecuteAsync(Batch batch, bool throwOnError = true)
    Parameters
    Batch batch

    Batch to execute

    System.Boolean throwOnError

    Throw an exception on the first encountered error in the batch

    Returns
    Task<PnP.Core.Model.SharePoint.List<BatchResult>>

    The asynchronous task that will be executed

    Implements
    IPnPContext.ExecuteAsync(Batch, Boolean)

    ExecuteAsync(Boolean)

    Method to execute the current batch

    Declaration
    public async Task<List<BatchResult>> ExecuteAsync(bool throwOnError = true)
    Parameters
    System.Boolean throwOnError

    Throw an exception on the first encountered error in the batch

    Returns
    Task<PnP.Core.Model.SharePoint.List<BatchResult>>

    The asynchronous task that will be executed

    Implements
    IPnPContext.ExecuteAsync(Boolean)

    GetLongRunningOperation(String)

    Gets an ongoing Graph long-running operation.

    Declaration
    public ILongRunningOperation GetLongRunningOperation(string location)
    Parameters
    System.String location

    The location of the operation

    Returns
    ILongRunningOperation

    An ILongRunningOperation associated with the location

    Implements
    IPnPContext.GetLongRunningOperation(String)

    NewBatch()

    Creates a new batch

    Declaration
    public Batch NewBatch()
    Returns
    Batch

    Implements
    IPnPContext.NewBatch()
    Back to top PnP Core SDK
    Generated by DocFX with Material UI
    spacer