pnp / PnP-Sites-Core

Microsoft 365 Dev PnP Core component (.NET) targeted for increasing developer productivity with CSOM based solutions.
Other
415 stars 642 forks source link

Style Library updates #327

Open PieterVeenstra opened 8 years ago

PieterVeenstra commented 8 years ago

I've got a clean Office 365 tenant and I've exported the root site that is created by default. Then I reimported template I'm getting:

[ERROR] Apply-SPOProvisioningTemplate : Access denied. You do not have permission to perform [ERROR] this action or access this resource. [ERROR] At line:1 char:1 [ERROR] + Apply-SPOProvisioningTemplate -Path d:\test.xml [ERROR] + ~~~~~~~~~~~~ [ERROR] + CategoryInfo : WriteError: (:) [Apply-SPOProvisioningTemplate], ServerUn [ERROR] authorizedAccessException [ERROR] + FullyQualifiedErrorId : EXCEPTION,OfficeDevPnP.PowerShell.Commands.Branding.Apply [ERROR] ProvisioningTemplate [ERROR]

When I stepped through the code I noticed that DraftVersionVisibility is being set.

Looking at my template file:

and I found DraftVersionVisibility="0" In the following check existingList.DraftVersionVisibility is set to "Author" if ((DraftVisibilityType)templateList.DraftVersionVisibility != existingList.DraftVersionVisibility) Then I checked the export as obviously the export should not give us "0" but Author instead. I then found that there is a type mismatch in a lot of files as int is used instead of DraftVisibilityType I tried this both on the dev and master branch.
Saurabh7019 commented 8 years ago

Hi, I am trying to create site columns and content types in clean Office 365 root site using PnP PowerShell but getting below error.

Apply-SPOProvisioningTemplate : Access denied. You do not have permission to perform this action or access this resource.

The error occurs only on root site. If I execute this command on any other site with URL containing \sites\ in it then it works fine.

Please let me know how can I resolve this.

PaoloPia commented 7 years ago

Hi Pieter, Can I assume that this issue has been fixed by the commit referenced above? Thanks.

Pieter-Veenstra commented 7 years ago

As there was a type mismatch between schema and code in core I am not sure if this was ever fully fixed. I will need to double check if that commit was accepted or not

PaoloPia commented 7 years ago

Ok, please let me know when you have time. Thanks.

PaoloPia commented 7 years ago

While waiting for you to confirm that the bug is fully solved, I will close this item. Please, feel free to ping me back to re-open it. Thanks.

Pieter-Veenstra commented 7 years ago

Hi paola,

I had the same yesterday where the style library gave access denied on update. I removed the library from the template manually as a quick work around

PaoloPia commented 7 years ago

Ok, I just reopened it. Thanks.

jansenbe commented 7 years ago

So the issue seems to be related to use not properly handling the DraftVersionVisibility on a style library?

Pieter-Veenstra commented 7 years ago

I've just come across this problem again. when using a clean tenant from demos.microsoft.com.

It looks like where the code does a list.Update() on the Style Library the next ExecuteQueryRetry is failing. even though no changes are made to the list within the PnP Code (or did I miss something). Maybe we should include the list.Update into the IsDirty section.

thunderstorm654 commented 7 years ago

I ran into the same bug today in the September version, so still an issue.