Issue: While fetching the Audit Log using API, Recently Downloaded Document is not retrieved from Audit Log
Configuration : Auditing enabled to "Viewing or Downloading Documents" at Site Collection Level
Below Code Used to Fetch the last 30 minutes of Audit Log
SPList list = web.Lists["MyLibrary"];
SPAuditQuery wssQuery = new SPAuditQuery(SPContext.Current.Web.Site);
wssQuery.RestrictToUser(SPContext.Current.Web.CurrentUser.ID);
wssQuery.AddEventRestriction(SPAuditEventType.View);
wssQuery.RestrictToList(list)
wssQuery.SetRangeEnd(DateTime.Now);
wssQuery.SetRangeStart(DateTime.Now.AddMinutes(-30)); // To get the last 30 Mins of data
SPAuditEntryCollection auditCol = SPContext.Current.Web.Site.Audit.GetEntries(wssQuery);
Steps to replicate the issue:
1. Download 3 documents sequentially
Pause for 15 seconds
2. Download next 2 documents sequentially
3. Execute above mentioned program
Result : Fetched only first 3 documents, documents which are downloaded after pause is not retrieved
4. Do Page Refresh
Result : I can See 5 Documents
Question :
Is Most recent download event pushed into Content DB by other relevant event ?? (Event : Page Refresh /New Download / Custom Report Generation etc ).
Page Refresh : Creates a view entry to Audit Log, So It pushes the Last download Event
New Download : Creates a view entry to Audit Log, So It pushes the Last download Event
Custom Report Generation : Creates a view entry to Audit Log, So It pushes the Last download Event
What is the solution to fetch all downloaded events through SPAudit Class?