如何從EventHandler - ItemAdded打開URL鏈接到SharePoint列表? 我試過了:SPUtility.Redirect,properties.RedirectUrl但它不起作用,mayby我做錯了什麼。請幫忙。如何從EventHandler打開URL - ItemAdded [SharePoint 2010]
感謝, 六合
如何從EventHandler - ItemAdded打開URL鏈接到SharePoint列表? 我試過了:SPUtility.Redirect,properties.RedirectUrl但它不起作用,mayby我做錯了什麼。請幫忙。如何從EventHandler打開URL - ItemAdded [SharePoint 2010]
感謝, 六合
我不知道你是否仍然有同樣的問題。 反正以下鏈接可能有助於某人。
http://www.sharepointkings.com/2008/06/redirection-from-event-handler.html
這一頁,但是,不正確地解釋HttpContext的是如何工作的
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 ...
}
}
應該牢記類名稱必須以獲得HttpContext的匹配。
此代碼適用於我。
這將需要將事件處理程序從ItemAdded切換到ItemAdding。 –
嗨,它不工作;(我使用:SPUtility.Redirect(「http:// xxxx:xx/sites/xxx/Lists/test/AllItems.aspx」,SPRedirectFlags.Trusted,HttpContext.Current);'和我有一個comunicat NullrefereceException – user900258