Track events on a Sharepoint document library + Object model + Audit reports

 If you want to know about the activities going on around your documents in a document library you can use the in-built Audit reports. For e.g. you would know who downloaded the document or who did check in check out and at what time etc.

Code snnipet -
SPSite site = new SPSite("YourSiteUrl");
SPAudit _auditCol = site.Audit;

foreach (SPAuditEntry _audit in _auditCol)
{

string Loginfo = _audit.DocLocation + " - " + _audit.Event.ToString());
}

0 comments:

Post a Comment

Popular Posts