How to get audit log settings in SharePoint 2013/Office 365 using CSOM?

Hello SharePointers,

Below are the code in CSOM to get the audit log settings in Office 365.Audit is the property to look out for.

string siteUrl = “https://MyTenant.sharepoint.com/sites/”;
var Pwd = new SecureString();
foreach (char c in “TenantAdminPwd”.ToCharArray()) Pwd.AppendChar(c);var siteCtx = new ClientContext(siteUrl);
siteCtx.Credentials = new SharePointOnlineCredentials(“admin@MyTenant.onmicrosoft.com”, Pwd);
Site site = siteCtx.Site;siteCtx.Load(site.Audit);

siteCtx.ExecuteQuery()

Happy Sharepointing folks 🙂

Leave a Reply

Your email address will not be published.