Survey 2遍的解决办法

比较正统的是用来与list item 的itemadding的event handler,代码如下:

 SPList currentList = properties.List;
           SPQuery query = new SPQuery();
           query.Query = "<Where><Eq><FieldRef Name='Author'/><Value Type='Integer'><UserID Type='Integer'/></Value></Eq></Where>";
           SPListItemCollection items = currentList.GetItems(query);
           if (items.Count == 1)
           {
               properties.Cancel = true;
               properties.Status = SPEventReceiverStatus.CancelWithRedirectUrl;
               properties.RedirectUrl = "/_Layouts/MyEventError.aspx";
           } 

这里必须要注意的是要Allow multuple reponse,不然ItemAdding触发不了。

Quoted from: http://go4answers.webhost4life.com/Example/catch-sharepoint-survey-cannot-vote-103714.aspx 感谢感谢。

posted @ 2013-01-26 21:20  举重-若轻  阅读(157)  评论(0编辑  收藏  举报