Context getting Deleted Site #659
-
We have a Durable Azure function that we use to create sites and apply templates. We based this on the PnP Azure Function v3 sample i.e. using dependency injection with In recent testing we came across an issue where a PnPContext created with a Site Url is pointing to a deleted site, even when the site has been re-created after emptying the tenant recycle bin. The context is always created with a using statement like so:
So it feels like the underlying connection somehow needs to be re-made because it has the old site GUID, like in PowerShell we might execute a |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
@anthonywhite : when we create a context using one of the CreateAsync method there are always two REST calls made to the site collection in question...so if you were able to create the If you created a context before the site collection was deleted then the context use that triggers a call to SharePoint Online would have resulted in an exception thrown. |
Beta Was this translation helpful? Give feedback.
-
Hi @jansenbe , thanks for your response. I was expecting the behaviour to be what you said, but the mystery is the site was deleted well before the function run instance (so before context creation). Unless the function runtime is holding an old object? |
Beta Was this translation helpful? Give feedback.
@anthonywhite : when we create a context using one of the CreateAsync method there are always two REST calls made to the site collection in question...so if you were able to create the
PnPContext
for a site collection that means the site collection was not deleted. If the site collection would have been delete or resided in the site collection recycle bin this operation would have failed.If you created a context before the site collection was deleted then the context use that triggers a call to SharePoint Online would have resulted in an exception thrown.