Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

SPAudit.GetEntries method (SPAuditQuery)

Gets a collection of SPAuditEntry objects from the audit data stored in the SharePoint database that match the specified query.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
public SPAuditEntryCollection GetEntries(
	SPAuditQuery query
)

Parameters

query
Type: Microsoft.SharePoint.SPAuditQuery

An SPAuditQuery object that defines the kind of audit data that is returned.

Return value

Type: Microsoft.SharePoint.SPAuditEntryCollection
An SPAuditEntryCollection that holds the requested SPAuditEntry items.
ExceptionCondition
UnauthorizedAccessException

The calling code is in the context of a user who is not a site administrator.

ArgumentException

query is a null reference (Nothing in Visual Basic).

For a simpler method that does not require you to create an SPAuditQuery object, see GetEntries.

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

SPSite oSiteCollection = (SPSite)properties.Feature.Parent;
SPAuditQuery oAuditQuery = new SPAuditQuery(oSiteCollection);
oAuditQuery.RestrictToListItem(item);
SPAuditEntryCollection collAuditEntries = oSiteCollection.Audit.GetEntries(oAuditQuery);

foreach (SPAuditEntry oAuditEntry in collAuditEntries) {
  // get info from audit log
}
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.