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

查看:135
本文介绍了如何获得有关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?

非常感谢您的答复.

我忘了提到我已经在Google上搜索并阅读了有关用户信息列表的信息.抱歉.

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上也不起作用(

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