Skip to content

PnP core SDK Context in Azure Function App v4 #893

Answered by jansenbe
Nevinia210 asked this question in Q&A
Discussion options

You must be logged in to vote

@Nevinia210 : why don't you use the OOB provided IPnPContextFactory as shown here (https://github.com/pnp/pnpcore/blob/dev/samples/Demo.AzureFunction.OutOfProcess.AppOnly/CreateSite.cs#L23) for using it and here for configuring it: https://github.com/pnp/pnpcore/blob/dev/samples/Demo.AzureFunction.OutOfProcess.AppOnly/Program.cs#L35-L64. Once you've done that you can create a PnPContext for the passed in URL via using (var pnpContext = await contextFactory.CreateAsync(new Uri("https://contoso.sharepoint.com/sites/asite")))

Regarding dispose, when you're using a using statement the PnPContext is disposed automatically, but for the moment there's nothing to dispose, this was build with futu…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by Nevinia210
Comment options

You must be logged in to vote
1 reply
@jansenbe
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants