Reputation: 33
I am trying to change the properties of a ListItem, but this does not work or the properties are not saved. Unfortunately, I do not receive an error message.
I have already tried to update the ListItem directly via the listItem.UpdateAsync()
function and also listItem.Properties.UpdateAsync()
.
But unfortunately none of it worked.
listItem.Properties["myProp"] = "myValue";
Does anyone have the same problem or does anyone have an idea how I can fix this?
My code example:
using var context = await PnpContextFactory.GsCreateContextAsync(
"https://xxxxxxxxxx.sharepoint.com/sites/xxxxxxxxxxxx");
var list = await context.Web.GsGetListAsync("/sites/xxxxxxxxx/xxxxxx");
var listItem = await list.Items.GetByIdAsync(6);
await listItem.LoadAsync(i => i.Properties);
listItem.Properties["myTestProp"] = "myTestValue";
await listItem.UpdateOverwriteVersionAsync();
await listItem.Properties.UpdateAsync();
The functions that I use to create the context and for the list are basic classes that work perfectly and are used productively in other projects.
Upvotes: 0
Views: 152