Updating SharePoint Online list item's modified timestamp using ADAL
-
23-01-2021 - |
Question
I've run into a strange issue where I cannot update a SharePoint Online list item's modified timestamp when I authenticate using ADAL. The update will occur (I see a new version added to the file), but the timestamp's value is not what I set it to. If I authenticate using SAML, everything works fine.
Here's my partial code:
SP.ListItem csomListItem = csomFile.ListItemAllFields;
context.Load(csomListItem);
csomListItem["Editor"]= modifiedBy
csomListItem["Modified"] = lastWriteTime
csomListItem.UpdateOverwriteVersion();
context.ExecuteQuery();
I've tried using both UpdateOverwriteVersion
and Update
. Both give me the same results where the last modified timestamp is set to the current time.
Solution
It turns out I did not have enough permissions set in Azure AD for the app. I would have expected to get some type of access denied error, but I didn't.
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange