Skip to content

Azure Function Sample, but with dynamic site url #733

Answered by RichieRoxx
RichieRoxx asked this question in Q&A
Discussion options

You must be logged in to vote

ok, was actually able to answer it myself, so I'll share this for anyone else maybe needing the same:

instead of of

using (var pnpContext = await ContextFactory.CreateAsync("Default"))
{
//doing sharepointstuff here
}

use

using (var pnpContext = await ContextFactory.CreateAsync(SiteUri))
{
//doing sharepointstuff here
}

SiteUri needs to be of type Uri of course and you need to define a default authentication provider in program.cs/startup.cs

 // Add and configure PnP Core SDK
                    services.AddPnPCore(options =>
                    {
//Begin of lines that need to be added to the referenced sample above                       
 // Configure an authentication provider with c…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@jansenbe
Comment options

@RichieRoxx
Comment options

Answer selected by RichieRoxx
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