SPAudit.Update method

Updates the SharePoint database with changes to the AuditFlags property

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

Syntax

'Declaration
Public Sub Update
'Usage
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();
' Turns on auditing of user views of the list item without changing
' any existing auditing settings.
oListItem.Audit.AuditFlags = (oListItem.Audit.AuditFlags Or 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 And (SPAuditMaskType.All Xor 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