Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

PowerShell: open site which was closed and set as read-only via a site policy

$
0
0

SharePoint site (SPWeb) was closed and set as read-only via a site policy (propagated from Content Type Hub). Now I'm trying to re-open the site via PowerShell:

$spWeb = Get-SPWeb $SiteUrl

$isClosed = [Microsoft.Office.RecordsManagement.InformationPolicy.ProjectPolicy]::IsProjectClosed($spWeb)

if($isClosed)
{
    [Microsoft.Office.RecordsManagement.InformationPolicy.ProjectPolicy]::OpenProject($spWeb)
}    

But during the execution of OpenProject($web) method I get the error

Exception calling "OpenProject" with "1" argument(s): "Sorry, this site hasn't been shared with you."
At D:\<scriptname>.ps1:88 char:9+         [Microsoft.Office.RecordsManagement.InformationPolicy.Project ...+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo          : NotSpecified: (:) [], MethodInvocationException+ FullyQualifiedErrorId : UnauthorizedAccessException

I am (the user from under whom PowerShell script is run) the site owner (site collection administrator) and have 'FullControl' permission level set in CentralAdministration via 'User Policy' for the web application where the site is located.

When I check permissions of my user (from which PowerShell script is run) on the site, I get the following picture (the site is in read-only state, after site policy application):

check permissions result

Is site policy application influence somehow permissions of users on the site where it's applied? 


v


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>