You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a web property is set with a key name containing special characters (e.g. "-") this can no longer be queried correctly. Because the name of a property named e.g. "SetWebProperties-Test1" is converted to "SetWebProperties_x002d_Test1" when it is set. The query of the property with the original name then fails.
Steps to reproduce
Sample test code:
var propertyKey1 = "SetWebProperties-Test1";
var myProperty = web.AllProperties.GetInteger(propertyKey1, 0);
if (myProperty == 0)
{
web.AllProperties[propertyKey1] = 55;
await web.AllProperties.UpdateAsync();
}
web = await context.Web.GetAsync(p => p.AllProperties);
myProperty = web.AllProperties.GetInteger(propertyKey1, 0);
// Here we are testing that the property was set correctly and exepect the previous set value. But it fails, the value is 0
Assert.IsTrue(myProperty == 55);
When I try to query the value with the converted key name, it works. Like:
var propertyKey1 = "SetWebProperties-Test1";
var myProperty = web.AllProperties.GetInteger(propertyKey1, 0);
if (myProperty == 0)
{
web.AllProperties[propertyKey1] = 55;
await web.AllProperties.UpdateAsync();
}
web = await context.Web.GetAsync(p => p.AllProperties);
myProperty = web.AllProperties.GetInteger("SetWebProperties_x002d_Test1", 0);
Assert.IsTrue(myProperty == 55);
Expected behavior
The property should be retrieved even if the key name contains the following characters - . / : < > | [ ]
The text was updated successfully, but these errors were encountered:
@LeHailender : I've just pushed a fix, will be part of the next nightly release so closing this issue now. Thanks for using PnP Core SDK and reporting this!
Category
Describe the bug
When a web property is set with a key name containing special characters (e.g. "-") this can no longer be queried correctly. Because the name of a property named e.g. "SetWebProperties-Test1" is converted to "SetWebProperties_x002d_Test1" when it is set. The query of the property with the original name then fails.
Steps to reproduce
Sample test code:
When I try to query the value with the converted key name, it works. Like:
Expected behavior
The property should be retrieved even if the key name contains the following characters - . / : < > | [ ]
The text was updated successfully, but these errors were encountered: