-
Notifications
You must be signed in to change notification settings - Fork 217
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Category
- Bug
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:
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 - . / : < > | [ ]
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working