This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Tht script checks is a site policy exists in a site collection. | |
.DESCRIPTION | |
.PARAMETER SiteUrl | |
URL of a site collection to check the policy existence. | |
.PARAMETER PolicyName | |
Name of the policy to check. | |
#> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$spWeb = Get-SPWeb $SiteUrl | |
# Check whether site is closed | |
$isClosed = [Microsoft.Office.RecordsManagement.InformationPolicy.ProjectPolicy]::IsProjectClosed($spWeb) | |
if($isClosed) | |
{ | |
[Microsoft.Office.RecordsManagement.InformationPolicy.ProjectPolicy]::OpenProject($spWeb) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using (var ctx = new ClientContext(this.SiteCollectionUri)) // TEST root site collection URL | |
{ | |
ctx.ExecutingWebRequest += (object sender, WebRequestEventArgs e) => | |
{ | |
// e.WebRequestExecutor.WebRequest.UserAgent = @"Mozilla/4.0 (compatible; MSIE 4.01; windows NT; MS Search 6.0 Robot)"; | |
e.WebRequestExecutor.WebRequest.Headers.Add(@"X-FORMS_BASED_AUTH_ACCEPTED", @"f"); | |
}; | |
var query = new KeywordQuery(ctx); | |
query.QueryText = "WebTemplate:STS"; |
NewerOlder