Update Items Quietly

There may come a time where you'll need to update many items in a list and doing it manually would take way to long. In this post, I'll show you how to modify list items without changing the last modified metadata and without firing an alert.



In this example, I'm going to change a single item in the announcements list. Here's my item before I edit it. I've highlighted the Title (which is what I'm going to change) and the last modified information.



Now, the code is simple. All I'm doing is getting the specific item by its ID and adding "(Changed)" to the end of the title. To make the change quietly, you can't use the item.Update() method. Instead, you'll use item.SystemUpdate(). SystemUpdate will make your changes without firing an alert or updating the last modified information.


After I run my code, you'll see that in the result, my title is changed and the last modified information is still the same.




One last thing. SystemUpdate also takes a boolean parameter. By default, the value is false; however, if you set it to true, the version number of your item will increment. If you choose to make the change and increment the version number using SystemUpdate(true), the last modified information will still remain the same and you still will not trigger an alert.

Labels: