1

I am using below code to enable Audit report.

Microsoft.SharePoint.Client.Site site = targetCtx.Site;
Audit audit = site.Audit;
targetCtx.Load(site);                
targetCtx.Load(site.RootWeb);
targetCtx.Load(site.RootWeb.AllProperties);
targetCtx.Load(audit);
targetCtx.ExecuteQuery();
site.RootWeb.AllProperties["_auditlogreportstoragelocation"]= site.ServerRelativeUrl + "/AuditData";
// Enable all auditing is site collection level
site.Audit.AuditFlags = Microsoft.SharePoint.Client.AuditMaskType.All;
site.Audit.Update();
// Adjust retention time to be 1 days
//site.AuditLogTrimmingRetention = 1;
site.TrimAuditLog = true;                
targetCtx.ExecuteQuery();

But I need to auto generate excel audit report to given document library automatically on daily basis using console APP.Is it possible?

Your Answer

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

Browse other questions tagged or ask your own question.