如何为 SharePoint 网站中的任何更改创建每日摘要警报 [英] How to create a daily summary alert for any change in a SharePoint site

查看:18
本文介绍了如何为 SharePoint 网站中的任何更改创建每日摘要警报的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近收到了一个要求,要求一个人每天收到有关 SharePoint 网站内任何更改的摘要警报;每个网站都有一个所有者负责其网站上的内容.

我们目前的工作方式是为站点内的每个列表/库自动设置警报.

//获取此站点上的列表SPListCollection siteLists = currentSite.Lists;foreach(siteLists 中的 SPList 列表){if (!list.ToString().Equals("Master Page Gallery")){if (list.ReadSecurity == 1)//用户对所有项目有读取权限{//为此列表创建警报Guid alertID = currentUser.Alerts.Add(list, SPEventType.All, SPAlertFrequency.Daily);//设置任何附加属性SPAlert newAlert = currentUser.Alerts[alertID];}}}

这会产生两个问题:

  1. 用户创建了许多不同的警报.理想:只有一封包含每日摘要的电子邮件.
  2. 必须设置某种监视器来检查站点中的新列表或库,并自动为用户设置警报.

问:如何为网站中的所有更改创建每日摘要警报?

解决方案

我相信您正在寻找的解决方案可通过审计框架获得.SP 中的审计非常强大,不幸的是很容易被输出淹没.

审核是 SPSite、SPWeb、SPList 和 SPItem 属性上可用的属性.

使用此属性调整特定审计标志(使用 .Audit.AuditFlags 属性)以满足您的需求(具体取决于您如何定义更改",但几乎所有您能想到的都可用).

有关SPAudit 对象的详细信息可在MSDN.

一旦您确定了要审核的内容/地点,您就必须将该信息返回给您的用户.

默认情况下,SP 设置了一些在网站集级别可用的不错的报告([网站集的网址]/_layouts/Reporting.aspx?Category=Auditing).这些可能会满足您的需求.

您最初的解决方案提到了通过电子邮件向用户发送警报.鉴于大多数用户都希望将他们的信息集中在电子邮件中(尽管他们的 MySite 是放置报告链接的好地方!)您还有一些工作要做.

您可以使用 SPAuditQuery 和 SPAuditEntryCollection 对象通过对象模型提取所需的审计信息.同样,MSDN 有一些关于如何使用这些对象的信息.>

我建议设置一个在一天结束时运行的自定义 SPJobDefinition,通过电子邮件将其站点的审核报告发送给用户.Andrew Connell 在他的博客上对如何设置自定义作业进行了很好的解释.

总结:

  • 启用对相关 SPWeb 的审核
  • 使用 SPAuditQuery 和 SPAuditEntryCollection 为每个 SPWeb 创建报告
  • 创建一个每晚运行的 SPJobDefinition,以通过电子邮件将报告发送给每个 SPWeb 所有者

I recently got the requirement for a person to receive a daily summary alert for any change within a SharePoint site; each site has an owner who is in charge of the content on their site.

The current way we have something working is to automatically set up alerts for every list/library within the site.

// Get the Lists on this Site
SPListCollection siteLists = currentSite.Lists;
foreach (SPList list in siteLists)
{
    if (!list.ToString().Equals("Master Page Gallery"))
    {
        if (list.ReadSecurity == 1) // user has read access to all items
        {
            // Create an Alert for this List
            Guid alertID = currentUser.Alerts.Add(list, SPEventType.All, SPAlertFrequency.Daily);

            // Set any additional properties
            SPAlert newAlert = currentUser.Alerts[alertID];
        }
    }
}

This creates two problems:

  1. The user has a lot of different alerts created. Ideal: Only ONE email with the daily summary.
  2. Some sort of monitor would have to be set up to check for new lists or libraries in the site and automatically set up alerts for the user.

Q: How can I create a daily summary alert for all changes in a site?

解决方案

I believe the solution you're looking for is available through the auditing framework. Auditing is very robust in SP, unfortunately it's easy to get overwhelmed by the output.

The Audit is a property available on the SPSite, SPWeb, SPList, and SPItem properties.

Adjust the specific audit flags (using the .Audit.AuditFlags properties) using this property to suite your needs (the specifics will depend on how you define "change" but almost anything you can think of is available).

Details about the SPAudit object are available on MSDN.

Once you've defined what/where you want to audit, you'll have to get that information back to your users.

By default, SP sets up some nice reports that available at the site collection level ([url of site collection]/_layouts/Reporting.aspx?Category=Auditing). These may meet your needs.

Your initial solution mentioned alerts via email for the users. Given that most users want to centralize their information in email (though their MySite is great place to put a link to the reports!) you'll have a little more work to do.

You can pull the required audit information through the object model using the SPAuditQuery and SPAuditEntryCollection objects. Again, MSDN has some information on how to use these objects.

I would recommend setting up a custom SPJobDefinition that runs at the end of the day to email the users the audit report for their site. Andrew Connell has a great explaination of how to setup a custom job on his blog.

To summarize:

  • enable auditing for the SPWeb's in question
  • create a report using SPAuditQuery and SPAuditEntryCollection for each SPWeb
  • create an SPJobDefinition that runs each night to email the report to each SPWeb owner

这篇关于如何为 SharePoint 网站中的任何更改创建每日摘要警报的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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