SharePoint【学习笔记】-- 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 @ 2013-02-21 15:23  绿森林  阅读(233)  评论(0编辑  收藏  举报