-
-
Notifications
You must be signed in to change notification settings - Fork 354
Unable to set modified date, created date and document id #330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Greetings, rather late but anyway, it is nowadays (in version ctx = ClientContext(site_url).with_credentials(credentials)
list_tasks = ctx.web.lists.get_by_title("Tasks")
items = list_tasks.items.get().top(1).execute_query()
if len(items) == 0:
sys.exit("No items for update found")
item_to_update = items[0] # type: ListItem
author = ctx.web.site_users.get_by_email(user_principal_name)
modified_date = datetime.utcnow() - timedelta(days=3)
result = item_to_update.validate_update_list_item({
"Author": FieldUserValue.from_user(author),
"Modified": modified_date
}).execute_query()
has_any_error = any([item.HasException for item in result.value])
if has_any_error:
print("Item update completed with errors, for details refer 'ErrorMessage' property")
else:
print("Item has been updated successfully") |
Hello. My goal is to preserve modification time after value is assigned to a custom property of SharePoint file (unfortunately it changes modification time, what is not desired). I did follow example above. The query did not return exception. Actually I got positive response (if time format was wrong I was getting HasException == True), but it did not modification time correctly. Actually file modification time was updated to the time of when this request was sent!
|
When I try to update a file’s created date and modified date it doesn’t get updated. I can see that on SharePoint a new version is created but the field values doesn’t change.
@vgrem: please help
Here is the code:
The text was updated successfully, but these errors were encountered: