Deletes all audit events that occurred before the specified date and time from the SharePoint database.
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
'Declaration Public Function DeleteEntries ( _ deleteEndDate As DateTime _ ) As Integer 'Usage Dim instance As SPAudit Dim deleteEndDate As DateTime Dim returnValue As Integer returnValue = instance.DeleteEntries(deleteEndDate)
public int DeleteEntries( DateTime deleteEndDate )
A DateTime representing the earliest date and time for which you want to preserve audit data.
The calling code is in the context of a user who is not a site administrator.
You may call object.Audit.DeleteEntries only when object is an SPSite object.
The deletion of audit entries is itself an audited event. A call to DeleteEntries creates an entry, and the method cannot delete the entry that it makes, so at least that one entry always exists in the database even if you attempt to delete all entries.
In Windows SharePoint Services 3.0, to delete all entries (except the entry described in the preceding paragraph) you cannot simply specify the current moment for deleteEndDate with Now. You must designate a future time. We recommend the following code, where mySiteCollection is a reference to an SPSite object.