none
SystemUpdate in powershell changing the Modified date RRS feed

  • Question

  • Hi all,

    I am trying to update a few columns to default values for existing listitems and I am doing SystemUpdate() at the end. But this is changing the Modified date. Kindly tell me how to rectify this?

    Thursday, June 16, 2016 12:29 AM

Answers

  • Hi Justin,

    Blame it on my oversight ! After further investigating, I found that the listitems whose dates were modified were created by a workflow which changed those dates. So this question is resolved now.

    • Marked as answer by sanjuv Thursday, June 16, 2016 9:58 AM
    Thursday, June 16, 2016 6:42 AM

All replies

  • did you use a system admin account to do this?

    顺其自然地勇往直前!—Justin Liu

    Thursday, June 16, 2016 2:14 AM
  • Yes it was an admin account. Does it matter which account does it ,as it is a SystemUpdate ?

    MSDN does not mention it anyway ,https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splistitem.systemupdate.aspx?f=255&MSPPError=-2147217396

    Here is an example which does the same,

    http://sharepointhangout.com/simple-fix-splistitem-systemupdate-boolean-true-vs-false-explained/

    Anyway i ran it as admin account and it changed the modified date value. How do I rectify this?

    Thursday, June 16, 2016 3:25 AM
  • try to use SPSecurity.RunWithElevatedPrivileges(delegate() {//your code} to check if this can work.

    顺其自然地勇往直前!—Justin Liu

    Thursday, June 16, 2016 3:30 AM
  • Hi Justin,

    Thanks for the reply.

     I ran the same script in another environment and it did not change the modified date there but why did it change the same in the current environment?

    Thursday, June 16, 2016 6:13 AM
  • Hi Justin,

    Blame it on my oversight ! After further investigating, I found that the listitems whose dates were modified were created by a workflow which changed those dates. So this question is resolved now.

    • Marked as answer by sanjuv Thursday, June 16, 2016 9:58 AM
    Thursday, June 16, 2016 6:42 AM
  • congratulations!

    顺其自然地勇往直前!—Justin Liu

    Thursday, June 16, 2016 7:54 AM
  • Hi sanjuv,

    I would suggest you can mark it as an answer so that it will help others who stuck with the same issue in the forum.

    Thanks

    Best Regards


    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.

    Thursday, June 16, 2016 9:46 AM