异常调用“GetPublishingPages”用“0”表示“0”。参数:“访问被拒绝。 (来自HRESULT的异常:0x80070005(E_ACCESSDENIED))" [英] Exception calling "GetPublishingPages" with "0" argument(s): "Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"

查看:110
本文介绍了异常调用“GetPublishingPages”用“0”表示“0”。参数:“访问被拒绝。 (来自HRESULT的异常:0x80070005(E_ACCESSDENIED))"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过PowerShell管理多个发布网站。几乎所有这些都很好,但我的一个发布网站似乎有问题。

I'm trying to manage a number of publishing sites through PowerShell. It's fine on nearly all of them, but one of my publishing sites seems to have a problem.

考虑以下PowerShell脚本:

Consider the following PowerShell script:

$NewWeb = Get-SPWeb $DestWeb 
$NewSite = Get-SPSite $DestSite

foreach($list in $NewWeb.Lists)
{
Write-Host "Library: $($list.Title); ListID: $($list.ID)" -ForegroundColor Green
}

$NewPublishingSite = New-Object Microsoft.SharePoint.Publishing.PublishingSite($NewSite)  
$NewPublishingWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($NewWeb)  

$DefaultPage = $NewPublishingWeb.DefaultPage
Write-host "DefaultPage = $DefaultPage"
$PagesList = $NewPublishingWeb.PagesList.ID
Write-Host "PagesList ID = $($PagesList)"
$NewPublishingPages = $NewPublishingWeb.GetPublishingPages()
foreach ($NewPage in $NewPublishingPages)
{
    Write-Host $NewPage.ListItem["Title"] -ForegroundColor Yellow
}

当我在几乎所有的发布网站上运行它时,我得到了一个很好的列表,列出了所有库的标题和ID ,以及网站中所有发布页面的列表。

When I run this on almost all of my publishing sites, I get a nice list of the titles and ID's of all of the libraries, as well as a list of all of the publishing pages in the site.

然而,在我的流氓网站中,我没有。 这第一个元素工作正常 - 获取一个列表所有库及其列表ID的。

However, in my rogue site, I don't. This first element works fine - getting a list of all of the libraries and their List ID's.

这是第二位没有 - 与发布网站本身交互。上面的脚本给出了以下结果:

It's the second bit that doesn't - interacting with the Publishing site itself. The above script gives the following result:

Library: Composed Looks; ListID: 4ed58df1-d48c-4865-8505-11e52ad599d3
Library: Documents; ListID: f06f4a2c-d715-4f56-8bc2-2c68e45e416b
Library: Images; ListID: 012fe035-73e0-463d-8967-83206bfe6236
Library: Master Page Gallery; ListID: 6b53ed8f-01dd-44c9-a4be-6defeafd3e79
Library: Media Library; ListID: 68a0bdf7-3bce-4071-a017-b87f6adc2969
Library: Pages; ListID: 01acbbda-373a-4faf-8fd0-0919103c9de8
Library: Site Assets; ListID: 08d350d3-188e-40ff-b53e-bbd4e22b57f0
Library: Site Collection Images; ListID: 6c7942de-1c92-496c-987a-9fdbabe3ef99
Library: Workflow Tasks; ListID: 67c29840-d699-42be-894b-4053cb7765f7
DefaultPage = Pages/news.aspx
PagesList ID = 

Exception calling "GetPublishingPages" with "0" argument(s): "Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"
At line:17 char:1
+ $NewPublishingPages = $NewPublishingWeb.GetPublishingPages()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : UnauthorizedAccessException

如您所见,脚本显然可以访问到网站(因为它能够执行函数的前半部分)。

As you can see, the script clearly has access to the site (as it is able to perform the first half of the function).

然而,它似乎没有拿起PublishingPagesList,也没有能够做任何其他事情" publishingWeb"有关。它表示它没有访问权限,即使它确实存在(参见前面的结果)。

However, it doesn't seem to pick up the PublishingPagesList, nor is it able to do anything else "publishingWeb" related. It says that it doesn't have access, even though it does (see earlier results).

问题是什么?

推荐答案

附加信息:事实上,它似乎适用于此Web应用程序中的所有发布站点;三个网络应用程序,这是唯一遇到此问题的人。
Additional Information: In fact, it seems to be for all Publishing Sites in this web app; of three web apps, this is the only one experiencing this problem.


这篇关于异常调用“GetPublishingPages”用“0”表示“0”。参数:“访问被拒绝。 (来自HRESULT的异常:0x80070005(E_ACCESSDENIED))"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆