Skip to content

Latest commit

 

History

History

samples

PnP Core Samples

Samples are best way to learn how to use, hence we've some example PnP Core SDK sample applications for you to learn. Following samples are available:

Azure functions

Sample Description .NET version PnP Core version Authentication Type Function mode
Managed identity Azure v4 Function using PnP Core SDK via dependency injection showing how to use a managed identity in combination with sites.selected to authenticate to SharePoint .NET 6 v1.8.0 Custom IAuthenticationProvider implementation + application permissions (X509CertificateAuthenticationProvider) V4, in-process
Out of process Azure v4 Function using PnP Core SDK via dependency injection showing how to create and configure a site collection .NET 6 v1.8.0 Application permissions (X509CertificateAuthenticationProvider) V4, isolated process
V3 function Azure v3 Function that shows how to use the PnP Core SDK via dependency injection .NET Core 3.1 v1.4.0 Application permissions (X509CertificateAuthenticationProvider) V3, in-process

Important

Another very useful Azure Functions sample is described on Sergei Sergeev's blog How to access SharePoint data from Azure Function with SPFx and PnP Core SDK. It shows how to setup an Azure Function using an on-behalf-of auth flow via the OnBehalfOfAuthenticationProvider and then call this Azure Function from a SharePoint Framework web part.

Web applications

Sample Description .NET version PnP Core version Authentication Type
ASPNet Core site Demo application showing how use the PnP Core SDK from an ASP.Net Core application .NET 7 v1.8.0 Custom authentication is used via the (ExternalAuthenticationProvider)
ASPNET Blazor app Sample Blazor WASM application that prototypes how the PnP Core SDK can be used in Blazor development .NET 7 v1.8.0 Custom IAuthenticationProvider implementation

Console applications

Sample Description .NET version PnP Core version Authentication Type
Minimal Console demo Most simplistic console app that shows how to use the PnP Core SDK for working with Microsoft 365 data .NET 6 v1.8.0 Interactive login (InteractiveAuthenticationProvider)
Console demo Demo console app that shows how to use the PnP Core SDK for working with Microsoft 365 data .NET 6 v1.8.0 Interactive login (InteractiveAuthenticationProvider)
Persistent TokenCache Demo console app that shows how to use the PnP Core SDK with a custom authentication provider that utilizes an MSAL token cache avoiding credential prompts after first login .NET 7 v1.8.0 Custom IAuthenticationProvider implementation
Pi demo Sample application running on dotNet Core on the Raspberry Pi .NET 7 v1.8.0 Username password login (UsernamePasswordAuthenticationProvider)

Desktop applications

Sample Description .NET version PnP Core version Authentication Type
WPF app Sample WPF windows application showing how dependency injection and the PnP Core SDK can be used in WPF/XAML apps .NET 7 v1.8.0 Interactive login (InteractiveAuthenticationProvider)