Export (0) Print
Expand All

SPAudit.Update method

Updates the SharePoint database with changes to the AuditFlags property

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

public void Update()

Call Update immediately after making changes to AuditFlags.

The following example shows how to change the audit settings for a list item. (The item is an object of type SPListItem.)

// Turns on auditing of user views of the list item without changing
// any existing auditing settings.
oListItem.Audit.AuditFlags = (oListItem.Audit.AuditFlags | SPAuditMaskType.View);
oListItem.Audit.Update();

// Turns off auditing of user views of the list item without changing
// any existing auditing settings.
oListItem.Audit.AuditFlags = (oListItem.Audit.AuditFlags & 
                        (SPAuditMaskType.All ^ SPAuditMaskType.View));
oListItem.Audit.Update();

// Turns on auditing of all types of events and actions relevant to 
// the list item.
oListItem.Audit.AuditFlags = SPAuditMaskType.All;
oListItem.Audit.Update();

// Turns off all auditing of the list item.
oListItem.Audit.AuditFlags = SPAuditMaskType.None;
oListItem.Audit.Update();
Show:
© 2014 Microsoft