2

I would like to know if there's a way to refresh the Auditing log programmatically, because we need it to see in real time which the last accessed document was within a Document Library.

Thanks, Brian

1

What do you mean by update? Change the data?

If you just need to view the data, some code like this has worked for me:

SPAuditQuery query = new SPAuditQuery(site);
query.AddEventRestriction(SPAuditEventType.View);
query.RestrictToList(list);
SPAuditEntryCollection auditCol = list.Audit.GetEntries(query);

Then you just loop through the auditCol and add it to a dataset and bind to a datagrid for output.

1

You may want to make sure you are setup to audit the events you are looking to capture. Here is a good overview blog post: http://sharepointknowledgebase.blogspot.com/2010/09/sharepoint2010-site-collection-auditing.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.