pnpframework icon indicating copy to clipboard operation
pnpframework copied to clipboard

CSOM - ApplyProvisioningTemplate - 403 Forbidden Error and Attempted to perform an unauthorized operation exception

Open v-vis1 opened this issue 4 years ago • 1 comments

I'm using PnPFramwork in my project to provision a O365 group enabled team site and then I want to apply a PnP template on top of the site. when I execute ApplyProvisioningTemplate on web with PnP Template to Create SharePoint List, Navigation links, I'm getting the below error: The remote server returned an error: (403) Forbidden. image

when I execute ApplyProvisioningTemplate on web with PnP Template to Client Side Pages with webpart, I'm getting the below exceptions: Attempted to perform an unauthorized operation. image

I haven't seen these issues on using SharePointPnPCoreOnline but it occurs with PnPFramework.

Connected the team site using SharePointOnlineCredentials with ServiceAccount and Secure Password. ServiceAccount have Owner access and Site collection Administrators permission to the site.

image

v-vis1 avatar Dec 31 '21 09:12 v-vis1

Looking on the mentioned code, it seems that the code has not been changed to use the app id model as explained on the migration guidance - https://github.com/pnp/pnpframework/blob/dev/docs/MigratingFromPnPSitesCore.md

With the PnP Framework you are required to use registered app id to align with the security principles and recommendations from security teams.

VesaJuvonen avatar Jan 03 '22 09:01 VesaJuvonen

This link is broken. Where is the guide now? Are there any PnP Framework samples out there? Thanks

Ofer-Gal avatar Mar 24 '23 09:03 Ofer-Gal