Skip to content
This repository has been archived by the owner on Jan 19, 2021. It is now read-only.

Enabled setting folder property bags on noscript sites #2544

Closed
wants to merge 3 commits into from

Conversation

jensotto
Copy link
Contributor

Type

  • Bug Fix
  • New Feature
  • Sample

Related Issues?

N/A

What is in this Pull Request ?

Setting properties on folders in document libraries is supported even on no script sites.

Web.IsNoScriptSite() extension method is not a definitive answer to if the site in fact is enabled for NoScript. This can also return true for sites that does not have NoScript enabled and the current user (or app only credentials) does not have required permissions to modify data.

@KoenZomers KoenZomers self-assigned this Mar 4, 2020
@KoenZomers
Copy link
Collaborator

Thanks @jensotto. I've given this PR a try on a modern teamsite, but am running into the ServerUnauthorizedAccessException even though I'm site collection admin. Can you provide more information in which scenario you managed so set a property bag value on a folder located in a site with noscript enabled?

@jensotto
Copy link
Contributor Author

jensotto commented Mar 4, 2020

@KoenZomers
This is what I did for a site with DenyAddAndCustomizePages enabled both OnPrem and Online:

Connect-PnPOnline <siteUrl> 
$folder = Get-PnPFolder "/<server relative URL to site>/shared documents"
$folder.Properties["Test"] = "Test"
$folder.Update()
$folder.Context.ExecuteQuery()

@KoenZomers KoenZomers mentioned this pull request Mar 7, 2020
@KoenZomers
Copy link
Collaborator

Thanks @jensotto. Key here was that you're not trying to set a propertybag value on the root folder but on any subfolder (Shared Documents in your sample). Then it indeed does work fine with this fix. Merging it through PR #2567

@KoenZomers KoenZomers closed this Mar 7, 2020
@jensotto jensotto deleted the enable-setting-folder-property-bag branch March 12, 2020 14:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants