Pages

Friday, October 18, 2013

Configure Audit Settings in SP 2013 Programatically

As you may get a requirement to configure Audit Settings for a Site Collection/ Web/List of SharePoint through Programatically. Listed out below the respective API and Methods which help for better understanding.

  • Regarding setting up storage location to save audit entries. By default the audit logs in sharepoint will save in the sharepoint database. If you want to store in particular document library, we need to below way. 
using Microsoft.Office.RecordsManagement.Reporting;
{
....
AuditLogTrimmingReportCallout.SetAuditReportStorageLocation(site, "{Documents Library Name}");
....
}
        For more detailed info please see
http://msdn.microsoft.com/en-us/library/microsoft.office.recordsmanagement.reporting.auditlogtrimmingreportcallout.setauditreportstoragelocation.aspx

  •   Regarding Setting up the Retention period, this is a straight forward where we have the respective property.       

      site.TrimAuditLog = true;
      site.AuditLogTrimmingRetention = 30;

  •  Be default the retention period will be 60 days in SharePoint.

No comments:

Post a Comment