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

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

问题描述

我实际上正在寻找一种方法来获取有关 SharePoint 组的任何更改的通知.首先,我虽然可以通过将事件处理程序附加到某种组列表来做到这一点.但不幸的是,没有代表 SharePoint 组的此类列表.

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.

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

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

那么,是否还有其他选项可以获取有关 SharePoint 组中事件的通知?

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

感谢到目前为止的回复.

Thanks for the reply so far.

我忘了提到我已经在谷歌上搜索并阅读了用户信息列表.对不起.

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

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

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.

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

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.

关于如何了解 SharePoint 组的更改的任何其他建议?

推荐答案

在组中添加或删除没有事件处理程序真的很烦人,这是我使用 Google 找到的最佳解决方案!是开启审计.

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天全站免登陆