开发者

How open URL from EventHandler - ItemAdded [SharePoint 2010]

How can I open URL link to Share开发者_高级运维Point list from EventHandler - ItemAdded ? I tried: SPUtility.Redirect, properties.RedirectUrl but it doesn't work, mayby I do something wrong. Please help.

Thanks, Luk


I dont know if you still having the same issue. Anyways the following link might help someone.

http://www.sharepointkings.com/2008/06/redirection-from-event-handler.html

This page, however, does not properly explain how httpcontext works

public class **CustomEventReceiver** : SPItemEventReceiver
{
    private HttpContext _currentContext = null;

    public CustomEventReceiver () : base ()
    {
        if (null != HttpContext.Current)
        {
            _currentContext = HttpContext.Current
        }
    }

    public override void ItemAdding (SPItemEventProperties properties)
    {
       // Here one can use _currentContext and redirect ...
    }
}

Should keep in mind that class names must match in order to get httpcontext.

This code works for me.


Here's the solution: http://www.sharepointkings.com/2008/06/redirection-from-event-handler.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜