Way*_*nch 1 powershell sharepoint sharepoint-2007 sharepoint-2010 sharepoint-2013
当我尝试通过 PowerShell 部署项目时,PS继续执行“Enable-SPFeature”操作,然后打印以下错误消息:
Enable-SPFeature :该页面的安全验证无效。单击 Web 浏览器中的“返回”,刷新页面,然后重试操作。在 E:\Demo\DemoProject\DemoProject\scripts\utility.ps1:315 char:19 + Enable-SPFeature <<<< -identity $id -url $url -confirm:$false + CategoryInfo : InvalidData: (Microsoft.Share ...etEnableFeature:SPCmdletEnableFeature) [Enable-SPFeature], SPException + ExcellentQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletEnableFeature
谁能提供解决方案吗?
小智 5
每当我们更新任何列表项、列表或SPWeb实例时,您可能会收到“此页面的安全验证无效。在 Web 浏览器中单击“返回”,刷新页面,然后重试您的操作”。这是因为在更新内容数据库的修改时需要进行一些安全验证,因此,为了避免该异常,我们必须将实例AllowUnsafeUpdates的属性设置SPWeb为 true。
SPWeb oWeb = new SPWeb();
oWeb.AllowUnsafeUpdates = true;
Run Code Online (Sandbox Code Playgroud)
AllowUnsafeUpdates属性用于获取或设置一个布尔值,该值指定是否允许由于 GET 请求而更新数据库或不需要安全验证。SPSite类也有这个属性。
| 归档时间: |
|
| 查看次数: |
5118 次 |
| 最近记录: |