SPListItem.SystemUpdate method

Updates the database with changes made to the list item without changing the Modified or Modified By fields.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'Declaration
Public Sub SystemUpdate
'Usage
Dim instance As SPListItem

instance.SystemUpdate()
public void SystemUpdate()

Remarks

When you call the SystemUpdate method, events are triggered and the modifications are reported in the Change and Audit logs, but alerts are not sent and properties are not demoted into documents.

Calling this method is the same as calling SystemUpdate(Boolean) with false.

Examples

The following example is a console application that uses the SystemUpdate method to make changes to a list item.

Imports System
Imports Microsoft.SharePoint

Module ConsoleApp
   Sub Main()
      Using site As SPSite = New SPSite("http://localhost")
         Using web As SPWeb = site.OpenWeb()

            Dim list As SPList = web.GetList("/lists/announcements/")
            If list.ItemCount > 0 Then
               ' Get an item to modify.
               Dim item As SPListItem = list.Items(0)

               ' Report the current state of the item.
               ReportState("Before", item)

               ' Modify it.
               If item.HasUniqueRoleAssignments Then
                  item.ResetRoleInheritance()
               Else
                  item.BreakRoleInheritance(True)
               End If

               ' Update without changing the modified time.
               item.SystemUpdate()

               ' Report the new state of the item.
               ReportState("After", item)
            End If

         End Using
      End Using

      Console.ReadLine()
   End Sub

   Sub ReportState(ByVal state As String, ByVal item As SPListItem)
      Console.WriteLine(state)
      Console.WriteLine("HasUniqueRoleAssigments: {0}", item.HasUniqueRoleAssignments)
      Console.WriteLine("Modified: {0}", item(SPBuiltInFieldId.Modified))
      If item.Fields.ContainsField("Modified_x0020_By") Then
         Console.WriteLine("Modified by: {0}", item(SPBuiltInFieldId.Modified_x0020_By))
      End If
      Console.WriteLine()
   End Sub

End Module
using System;
using Microsoft.SharePoint;

namespace Test
{
   class ConsoleApp
   {
      static void Main(string[] args)
      {
         using (SPSite site = new SPSite("http://localhost"))
         {
            using (SPWeb web = site.OpenWeb())
            {
               SPList list = web.GetList("/lists/announcements/");
               if (list.ItemCount > 0)
               {
                  // Get an item to modify.
                  SPListItem item = list.Items[0];

                  // Report the current state of the item.
                  ReportState("Before", item);

                  // Modify it.
                  if (item.HasUniqueRoleAssignments)
                     item.ResetRoleInheritance();
                  else
                     item.BreakRoleInheritance(true);

                  // Update without changing the modified time.
                  item.SystemUpdate();

                  // Report the new state of the item.
                  ReportState("After", item);
               }
            }
         }
         Console.ReadLine();
      }

      static void ReportState(string state, SPListItem item)
      {
         Console.WriteLine(state);
         Console.WriteLine("HasUniqueRoleAssigments: {0}", item.HasUniqueRoleAssignments);
         Console.WriteLine("Modified: {0}", item[SPBuiltInFieldId.Modified]);
         if (item.Fields.ContainsField("Modified_x0020_By"))
            Console.WriteLine("Modified by: {0}", item[SPBuiltInFieldId.Modified_x0020_By]);
         Console.WriteLine();
      }

   }
}

See also

Reference

SPListItem class

SPListItem members

SystemUpdate overload

Microsoft.SharePoint namespace