【发布时间】:2021-03-23 14:15:49
【问题描述】:
对于内部审计/验证,我是否需要加载我的租户中的所有站点,其中站点的 classification 设置为“仅限内部”(为我们的租户创建的自定义分类)。
似乎我无法使用标准 PowerShell 模块 Microsoft.Online.SharePoint.PowerShell 检索分类 - Get-SPOSite 返回的对象根本没有提供属性 Classification。
我发现的唯一方法是使用PnP.PowerShell,请参阅Microsoft 文档Programmatically read the classification of a site:
Connect-PnPOnline "https://[tenant].sharepoint.com/sites/[modernsite]" -Credentials [credentials]
$site = Get-PnPSite
$classificationValue = Get-PnPProperty -ClientObject $site -Property Classification
Write-Host $classificationValue
但是基于 PnP.PowerShell 的方法的问题在于,我需要成为该站点的管理员/所有者才能加载站点对象。如果我不是管理员/所有者,在执行Get-PnPSite 时会出现以下错误:
Get-PnPSite : The remote server returned an error: (401) Unauthorized.
现在的问题是,我是否可以在不成为网站集管理员的情况下检索租户中所有网站的分类?
【问题讨论】:
标签: powershell sharepoint-online