Guest User

Untitled

a guest
Nov 16th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. using (var context = this.sharePointOnlineAuthenticationHelper.GetClientContextWithAccessToken(siteUri.ToString(), siteToken))
  2. {
  3. var site = context.Site;
  4. context.Load(site, s => s.Audit, s => s.AuditLogTrimmingRetention, s => s.TrimAuditLog);
  5.  
  6. context.ExecuteQuery();
  7. site.TrimAuditLog = true;
  8. site.Audit.AuditFlags = AuditMaskType.All;
  9. site.Audit.Update();
  10. context.ExecuteQuery();
  11. }
  12.  
  13. private static void setAuditReportLibrary(String targetSiteUrl)
  14. {
  15. using (var ctx = new ClientContext(targetSiteUrl))
  16. {
  17.  
  18. var web = ctx.Web;
  19. ctx.Load(web);
  20. ctx.ExecuteQuery();
  21.  
  22. var allProperties = web.AllProperties;
  23. allProperties["_auditlogreportstoragelocation"] = "/site/LibraryName";
  24.  
  25. web.Update();
  26. ctx.ExecuteQuery();
  27. }
  28. }
Add Comment
Please, Sign In to add comment