我試圖將記錄添加到sharepoint 2010的「鏈接」列表中。 我想要添加項目驗證。我是這樣寫的。 在將記錄添加到sharepoint 2010中的列表時檢查條件時出現「空引用異常」
我試圖停止輸入任何包含谷歌關鍵字的鏈接。下面的代碼中是否有任何錯誤。我正在爲我的練習而努力。 我認爲在圖像代碼中顯示不清晰。我在這裏寫下。
if (properties.AfterProperties["vti_url"].ToString().Contains("google"))
{
properties.ErrorMessage = "You should not enter the google";
properties.Cancel = true;
}
添加properties.AfterProperties["URL"].ToString().Contains("google")
後,它運行良好。但是我的錯誤頁面看起來不太好。這裏是屏幕截圖。該怎麼做這個問題。
如果有'屬性,你檢查。 AfterProperties [「vti_url」]'返回'null'? – Hinek 2012-07-25 07:35:43