如何获取有关SharePoint组更改的通知 [英] How to get notified about changes on SharePoint groups

查看:181
本文介绍了如何获取有关SharePoint组更改的通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我实际上正在寻找一种通知SharePoint组上的任何更改的方式。首先,尽管我可以通过将事件处理程序附加到某种组列表来实现。但不幸的是没有这样的表示SharePoint组的列表。



我的第二个尝试是将事件处理程序绑定到SharePointGroup的内容类型,但这也不起作用。



还有什么其他选项可以收到有关SharePoint组的事件的通知?



再见,
Flo



编辑:



感谢您迄今为止的回复。 / p>

我忘了提到我已经搜索并阅读了用户信息列表。对不起,



首先我发现一个论坛条目,他们将相对URL发布到用户信息列表(_catalogs / users / simple.aspx)。当我使用此链接查看列表时,它只包含用户,没有组。我不知道,但也可能这个链接在列表中进行一些过滤。



我在几个博客和论坛帖子中发现的其他信息是附加到用户信息列表不会在事件上被激活。阅读后,我不得不承认,它不会很多次,甚至在MSDN上( http://msdn.microsoft.com/en-us/library/aa979520.aspx ),我没有自己尝试。



将事件处理程序附加到内容类型的问题不是附加的事情,当我例如更改组名称或从组中删除用户时,处理程序根本没有被触发。我没有一个想法为什么处理程序不会被调用我很确定我实现了正确的方法并将它们附加到正确的事件。



任何其他建议如何了解SharePoint群组的变化?

解决方案

真的很讨厌添加或删除一个小组没有一个事件处理程序,我发现使用Google最好的工作!将开始审核。



然后通过审核循环启动我的活动。

  wssQuery = new SPAuditQuery(site); 
wssQuery.AddEventRestriction(SPAuditEventType.SecGroupMemberAdd);
wssQuery.AddEventRestriction(SPAuditEventType.SecGroupMemberDel);
wssQuery.SetRangeStart(startTime.AddMinutes(-16));
auditCol = site.Audit.GetEntries(wssQuery);




foreach(auditCol中的SPAuditEntry条目)
{
xml.LoadXml(< event>+ entry.EventData +< / event>);

int userId = Int32.Parse(xml.SelectSingleNode(/ event / user)。InnerText);
int groupId = Int32.Parse(xml.SelectSingleNode(/ event / groupid)。InnerText);

if(entry.Event == SPAuditEventType.SecGroupMemberAdd)
{
// Do Stuff
}

if(entry.Event == SPAuditEventType.SecGroupMemberDel)
{
// Do Stuff
}


}

确实导致添加到组中的成员和事件触发之间的严重延迟!



我在审计中找不到事件处理程序,所以唯一的选择似乎是循环。



这对我来说很贵,因为我们有数百个网站集!


I'm actual looking for a way to get notified about any changes on a SharePoint group. First I though I would be able to this by attaching a event handler to some kind of group list. But unfortunately there are no such list representing SharePoint groups.

My second attempt was to bind a event handler to the content type SharePointGroup but this didn't work either.

So are there any other options to get notified about events on a SharePoint group?

Bye, Flo

EDIT:

Thanks for the reply so far.

I forgot to mention that I've already googled and read about the user information list. Sorry.

First I found a forum entry where they post the relative URL to the user information list (_catalogs/users/simple.aspx). When I'm using this link to see the list,it only contains users and no groups. I don't know but perhaps this link does some filtering on the list.

The other information I found about in several blog and forum posts was that a event handler attached to the user information list are not fired up on an events. I have to admit after reading that it doesn't work so many times and even on MSDN (http://msdn.microsoft.com/en-us/library/aa979520.aspx), I didn't try it on my own.

The problem attaching the event handler to the content type wasn't the attaching thing, the handler simply didn't get fired when I for example changed a group name or deleted a user from the group. I don't have an idea why the handler doesn't get called I pretty sure I implemented the right methods and attached them to the right events.

Any other suggestions how to get informed about changes on SharePoint groups?

解决方案

It is really annoying that adding or removing from a group doesn't have an event handler the best work around I have found using Google! is to turn on auditing.

Then periodicaly loop through the audit to fire my event.

            wssQuery = new SPAuditQuery(site);
            wssQuery.AddEventRestriction(SPAuditEventType.SecGroupMemberAdd);
            wssQuery.AddEventRestriction(SPAuditEventType.SecGroupMemberDel);
            wssQuery.SetRangeStart(startTime.AddMinutes(-16));
            auditCol = site.Audit.GetEntries(wssQuery);




            foreach (SPAuditEntry entry in auditCol)
            {
                    xml.LoadXml("<event>" + entry.EventData + "</event>");

                    int userId = Int32.Parse(xml.SelectSingleNode("/event/user").InnerText);
                    int groupId = Int32.Parse(xml.SelectSingleNode("/event/groupid").InnerText);

                    if (entry.Event == SPAuditEventType.SecGroupMemberAdd)
                    {
                       // Do Stuff
                    }

                    if (entry.Event == SPAuditEventType.SecGroupMemberDel)
                    {
                        // Do Stuff
                    }


             }

It does cause a serious delay between the member being added to the group and the event firing though!

I couldn't find an event handler on the audit either so the only option seems to be looping through.

This is expensive for me as we have hundreds of site collections!

这篇关于如何获取有关SharePoint组更改的通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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