使用SOM启用和取消审核功能 [英] Enable and Disbale Audit Feature using SOM

查看:62
本文介绍了使用SOM启用和取消审核功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的

我需要使用服务器对象模型在网站集的根站点中启用审核功能,并收集信息并禁用审核功能".

I need to enable the Audit Feature in Root Site of site collection using server object model and gather the information and disable "Audit Feature".

任何人都可以帮助我知道我该怎么做

Can any one help me in knowing how can I do this

谢谢,
优质的交流提供
质量工作.
萨姆.

Thanks,
Quality Communication Provides
Quality Work.
SAM .

推荐答案

您可以尝试Ramesh共享的解决方案.

Enabel:

Site= ctx.Site;    
Audit audit = site.Audit;    
ctx.Load(site);    
ctx.Load(audit);    
ctx.ExecuteQuery();    
// Enable all auditing is site collection level    
audit.AuditFlags = Microsoft.SharePoint.Client.AuditMaskType.All;    
audit.Update();    
// Adjust retention time to be 30 days    
site.AuditLogTrimmingRetention = 30;    
site.TrimAuditLog = true;    
ctx.ExecuteQuery(); 

禁用:

Site= ctx.Site;      
Audit audit = site.Audit;      
ctx.Load(site);      
ctx.Load(audit);      
ctx.ExecuteQuery();      
// Set remove any auditing from site colelction level      
audit.AuditFlags = Microsoft.SharePoint.Client.AuditMaskType.None;      
audit.Update();      
site.TrimAuditLog = false;      
ctx.ExecuteQuery(); 

最好的问候,


这篇关于使用SOM启用和取消审核功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆