pnpframework icon indicating copy to clipboard operation
pnpframework copied to clipboard

Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

Open Hrdy11 opened this issue 1 year ago • 3 comments

Getting issue while trying apply SharePoint site Security and Supported UI Language Template.

Issue: {"Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"}

Hrdy11 avatar Aug 11 '22 07:08 Hrdy11

I was just going to write an issue about this with some more info and investigation. Are you applying templates in separate files and already run WebSettings before running supported UI languages? If so, try Disconnect-PnPOnline and Connect-PnPOnline to the site and run that part of the template again which has UI languages.

jhholm avatar Aug 11 '22 11:08 jhholm

Not sure if this is a PnP Framework or PnP PowerShell issue or CSOM issue.

Using PnP PowerShell 1.11.0. I was able to reproduce this in two ways

Connect-PnPOnline https://<tenant>.sharepoint.com/sites/<yoursite>
Get-PnPWeb -Includes NoCrawl
Invoke-PnPSiteTemplate -Path ./languages.xml

Or

Connect-PnPOnline https://<tenant>.sharepoint.com/sites/<yoursite>
Invoke-PnPSiteTemplate -Path ./websettings.xml
Invoke-PnPSiteTemplate -Path ./languages.xml

Websettings.xml is a PnP template that contains only an empty WebSettings tag. Languages.xml only contains Supported UI Languages. If I only connect to the site and apply the language template, it seems to work.

So the following goes ok. And also if you use Disconnect-PnPOnline after an error and reconnect.

Connect-PnPOnline https://<tenant>.sharepoint.com/sites/<yoursite>
Invoke-PnPSiteTemplate -Path ./languages.xml

jhholm avatar Aug 11 '22 12:08 jhholm

Hey @jhholm thanks for the interest. Yes I am applying template one by one I have created separate template for every part like header, footer, web setting, language etc. I was just applying single template for both of this without applying WebSettings template and I got stuck here, and I am using CSOM code to apply and generate the templates.

Hrdy11 avatar Aug 17 '22 04:08 Hrdy11