【问题标题】:How to create SharePoint Survey with expiration date?如何创建具有到期日期的 SharePoint 调查?
【发布时间】:2012-06-09 11:36:30
【问题描述】:

我有自定义调查,在 RootWeb.Properties 中有过期日期。如何将所有希望在过期日期后回复调查的用户(单击“回复调查”或使用直接链接到 NewForm.aspx)重定向到带有一些自定义文本(例如“此调查已过期”)的自定义页面?

【问题讨论】:

    标签: sharepoint survey


    【解决方案1】:

    您可以编写一个事件接收器来实现这一点。在事件接收器代码上,您可以检查到期日期,如果到期,您可以取消项目添加并将用户重定向到自定义页面。请注意,您的自定义 url 必须是相对 url。

    public override void ItemAdding(SPItemEventProperties properties)
       {
           base.ItemAdding(properties);
           if (DateTime.Now > "your expiration date")
           {
               properties.Status = SPEventReceiverStatus.CancelWithRedirectUrl;
               properties.RedirectUrl = "your custom url";
           }
       }
    

    【讨论】:

    • 我认为当用户填写所有字段并单击提交按钮时,此事件接收器将执行。当用户点击“回复调查”时,我需要重定向用户
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-09-17
    • 1970-01-01
    相关资源
    最近更新 更多