Share via


SPAudit.Update Method

Updates the SharePoint database with changes to the AuditFlags property

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

Syntax

Public Sub Update

Dim instance As SPAudit

instance.Update()
public void Update()

Remarks

Call Update immediately after making changes to AuditFlags.

Examples

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();

See Also

Reference

SPAudit Class

SPAudit Members

Microsoft.SharePoint Namespace

Other Resources

Item-Level Auditing with SharePoint Server 2007