IAlertNotifyHandler 的 OnNotification() 返回值有什么作用?
到目前为止,我已经使用 IAertNotifyHandler 接口。 使用此接口,您必须实现一个名为 OnNotification( ),它具有以下签名:
bool OnNotification (SPAlertHandlerParams ahp);
如您所见,此方法应该返回一个布尔值。 官方MSDN文档列出了该返回值的如下解释:
true(如果是 Windows SharePoint Services) 将通知标记为已处理; 否则错误
起初我认为这意味着如果您返回true,您将向SharePoint 发出信号,表明您的处理程序已完成所有警报处理,并且SharePoint 不应执行其默认行为。 然而,实际上,处理警报的方式似乎没有任何区别。 您可以返回true或false,这没有任何区别。
然后我使用Reflector反汇编了源代码,但不幸的是处理OnNotification返回值的代码不是托管的,而是原生的。
那么谁知道这个返回值意味着什么?
BY now I've created a number of custom alert handlers for SharePoint 2007 using the IAlertNotifyHandler interface. Using this interface you have to implement a method called OnNotification(), which has the following signature:
bool OnNotification (SPAlertHandlerParams ahp);
As you can see this method should return a boolean value. The official MSDN docs list the following explanation of this return value:
true if Windows SharePoint Services
marks the notification as processed;
otherwise false
At first I thought this meant that if you return true you signal SharePoint that your handler has done all alert processing and SharePoint shouldn't execute its default behaviour. However, in practice there doesn't seem to be any difference in the way the alerts are handled. You can return true or false, it doesn't make any difference.
I then used Reflector to dissassemble the source code, but unfortunately the code that processes OnNotification's return value isn't managed, but native.
So who knows what that return value means?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信这仅在摘要警报(每日或每周摘要)的情况下考虑,而不是立即警报。 如果在处理摘要警报时返回 false,则相同的项目将在下一个摘要警报中发送给用户。
I believe this is only considered in the case of Digest alerts (Daily or Weekly summaries) and not for Immediate alerts. If you return false when handling a summary alert, the same items will be sent to the user in the next summary alert.