1

I would like to add an indexed property bag value to some of my SharePoint Sites that is called "former names". I would like to add multiple string values or an array of string values under the one key.

The Set-PnPPropertyBagValue only accepts String from the docs: Set-PnPPropertyBagValue.

Something to the effect of:

Set-PnPPropertyBagValue -Key "former names" -Value ["joe", "jane"] -Indexed

or

Set-PnPPropertyBagValue -Key "former names" -Value "joe, jane" -Indexed

I want to avoid a situation where I set multiple keys like this "former name 1", "former name 2".

Thanks in advance.

0

Per my online searching and test, it seems that we just can set one value for a property bag.

If you want to use multiple values, I am afraid you need to use multiple property bags.

  • Thanks Kally, I was afraid that this would be the case. I guess the workaround would for me to create a Metadata column and attach it to the default Site Pages doc lib. Would you happen to know a column that could meet my needs? I'm guessing Choice column with allow multiple choices.. – Ushka Jan 10 at 16:15
0

Property bag items only hold a single value, but assuming you are in full control of the code that is going to read/consume the custom property bag value, there is no reason why that value couldn't be a comma-delimited list that you will always plan on calling .split() when retrieving the value, or a string-ified json that you will always convert to object when retrieving the value. If you are indexing it because you want it to be searchable, a keyword search is still going to find the "names". For example, if you saved the string "joe, jane" in that index property bag value, and later searched for "jane" it would still hit in the results.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.