Поделиться через


SPAuditQuery Class

Defines a query of the audit entries of the SharePoint database.

Inheritance Hierarchy

System.Object
  Microsoft.SharePoint.SPAuditQuery

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

Syntax

<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel := True)> _
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
Public NotInheritable Class SPAuditQuery

Dim instance As SPAuditQuery
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)]
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
public sealed class SPAuditQuery

Remarks

The fundamental scope of any query is always a site collection; but you can use the members of the class to restrict a query to particular date ranges, users, event types, lists, and list items.

This class is primarily used as a parameter to the GetEntries(SPAuditQuery) method.

You cannot use this class to query the SharePoint database for anything other than the records of audited events.

Examples

The following example (from Item-Level Auditing with SharePoint Server 2007) shows this class in use.

SPAuditQuery wssQuery = new SPAuditQuery(siteCollection);
wssQuery.RestrictToListItem(item);
SPAuditEntryCollection auditCol = site.Audit.GetEntries(wssQuery);

foreach (SPAuditEntry entry in auditCol) {
  // get info from audit log
}

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

SPAuditQuery Members

Microsoft.SharePoint Namespace

Other Resources

Item-Level Auditing with SharePoint Server 2007