Interface IPnPContext
PnPContext interface to support mocking (that's the only reason)
public interface IPnPContext : IDisposable
- Inherited Members
- Extension Methods
Properties
AuthenticationProvider
Connected authentication provider
IAuthenticationProvider AuthenticationProvider { get; }
Property Value
AzureADLoginAuthority
Returns the Azure AD Login authority (e.g. login.microsoftonline.com) to use when Environment is set to Custom
string AzureADLoginAuthority { get; }
Property Value
ContentTypeHub
Entry point for the ContentTypeHub Object
IContentTypeHub ContentTypeHub { get; }
Property Value
CurrentBatch
Current batch, used for implicit batching
Batch CurrentBatch { get; }
Property Value
Environment
Returns the used Microsoft 365 cloud environment
Microsoft365Environment? Environment { get; }
Property Value
GraphAlwaysUseBeta
If true than all requests to Microsoft Graph use the beta endpoint
bool GraphAlwaysUseBeta { get; set; }
Property Value
GraphCanUseBeta
If true than the Graph beta endpoint is used when there's no other option, default approach stays using the v1 endpoint
bool GraphCanUseBeta { get; set; }
Property Value
GraphClient
Connected Microsoft Graph client
MicrosoftGraphClient GraphClient { get; }
Property Value
GraphFirst
Controls whether the library will try to use Microsoft Graph over REST whenever that's defined in the model
bool GraphFirst { get; set; }
Property Value
Group
Entry point for the Group Object
IGraphGroup Group { get; }
Property Value
HasPendingRequests
Are there pending requests to execute (in the case of batching)
bool HasPendingRequests { get; }
Property Value
Logger
Connected logger
ILogger Logger { get; }
Property Value
Me
Entry point for the Me Object
IMe Me { get; }
Property Value
MicrosoftGraphAuthority
Returns the Microsoft Graph authority (e.g. graph.microsoft.com) to use when Environment is set to Custom
string MicrosoftGraphAuthority { get; }
Property Value
Properties
Collection for custom properties that you want to attach to a PnPContext
IDictionary<string, object> Properties { get; }
Property Value
RestClient
Connected SharePoint REST client
SharePointRestClient RestClient { get; }
Property Value
Site
Entry point for the Site Object
ISite Site { get; }
Property Value
Social
Entry point for the Social Object
ISocial Social { get; }
Property Value
Team
Entry point for the Team Object
ITeam Team { get; }
Property Value
TermStore
Entry point for the TermStore Object
ITermStore TermStore { get; }
Property Value
Uri
Uri of the SharePoint site we're working against
Uri Uri { get; }
Property Value
Web
Entry point for the Web Object
IWeb Web { get; }
Property Value
Methods
Clone()
Clones this context into a new context for the same SharePoint site
PnPContext Clone()
Returns
- PnPContext
New PnPContext
Clone(Guid)
Clones this context for another SharePoint site
PnPContext Clone(Guid groupId)
Parameters
groupIdGuidId of the other Microsoft 365 group to create a PnPContext for
Returns
- PnPContext
New PnPContext
Clone(string)
Clones this context for another SharePoint site provided as configuration
PnPContext Clone(string name)
Parameters
namestringThe name of the SPOContext configuration to use
Returns
- PnPContext
New PnPContext for the request config
Clone(Uri)
Clones this context for another SharePoint site
PnPContext Clone(Uri uri)
Parameters
uriUriUri of the other SharePoint site
Returns
- PnPContext
New PnPContext
CloneAsync()
Clones this context into a new context for the same SharePoint site
Task<PnPContext> CloneAsync()
Returns
- Task<PnPContext>
New PnPContext
CloneAsync(Guid)
Clones this context for another SharePoint site
Task<PnPContext> CloneAsync(Guid groupId)
Parameters
groupIdGuidId of the other Microsoft 365 group to create a PnPContext for
Returns
- Task<PnPContext>
New PnPContext
CloneAsync(string)
Clones this context for another SharePoint site provided as configuration
Task<PnPContext> CloneAsync(string name)
Parameters
namestringThe name of the SPOContext configuration to use
Returns
- Task<PnPContext>
New PnPContext for the request config
CloneAsync(Uri)
Clones this context for another SharePoint site
Task<PnPContext> CloneAsync(Uri uri)
Parameters
uriUriUri of the other SharePoint site
Returns
- Task<PnPContext>
New PnPContext
Execute(Batch, bool)
Method to execute a given batch
List<BatchResult> Execute(Batch batch, bool throwOnError = true)
Parameters
batchBatchBatch to execute
throwOnErrorboolThrow an exception on the first encountered error in the batch
Returns
- List<BatchResult>
The asynchronous task that will be executed
Execute(bool)
Method to execute the current batch
List<BatchResult> Execute(bool throwOnError = true)
Parameters
throwOnErrorboolThrow an exception on the first encountered error in the batch
Returns
- List<BatchResult>
The asynchronous task that will be executed
ExecuteAsync(Batch, bool)
Method to execute a given batch
Task<List<BatchResult>> ExecuteAsync(Batch batch, bool throwOnError = true)
Parameters
batchBatchBatch to execute
throwOnErrorboolThrow an exception on the first encountered error in the batch
Returns
- Task<List<BatchResult>>
The asynchronous task that will be executed
ExecuteAsync(bool)
Method to execute the current batch
Task<List<BatchResult>> ExecuteAsync(bool throwOnError = true)
Parameters
throwOnErrorboolThrow an exception on the first encountered error in the batch
Returns
- Task<List<BatchResult>>
The asynchronous task that will be executed
GetLongRunningOperation(string)
Gets an ongoing Graph long-running operation.
ILongRunningOperation GetLongRunningOperation(string location)
Parameters
locationstringThe location of the operation
Returns
- ILongRunningOperation
An ILongRunningOperation associated with the location
NewBatch()
Creates a new batch
Batch NewBatch()