SPWeb.EnsureUser()注意AllowUnsafeUpdates=true

使用时一直报异常,后仔细看它的定义

SPWeb.EnsureUser
方法 (Microsoft.SharePoint)

Checks whether the specified login name belongs to a valid user of the Web
site, and if the login name does not already exist, adds it to the Web site.

 

它会对SPWeb进行更改操作,那么SPWeb.AllowUnsafeUpdates = true;就是免不了的了

posted @ 2011-12-07 12:35  ruijian  阅读(370)  评论(0编辑  收藏  举报