1

I am looking for a script to enable DocID and set a Prefix. Found this solution here: http://blog.repsaj.nl/index.php/2015/04/o365-enable-document-id-and-set-prefix-via-csom/ .

But how bind into a PowerShell script?

Thanks in Advance

Viktor

1 Answer 1

2

The following PowerShell script for your reference.

##Variables for Processing
$SiteUrl = "https://lz.sharepoint.com/sites/team"
$UserName="[email protected]"
$Password ="xxx"

Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll" 
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"

#Setup Credentials to connect
$Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($UserName,(ConvertTo-SecureString $Password -AsPlainText -Force))
#Setup the context
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
$ctx.Credentials = $Credentials
$web = $ctx.web
$props = $web.AllProperties
$props["docid_msft_hier_siteprefix"] = "MYPREFIX"
$props["docid_enabled"] = "1"
$web.Update()
$ctx.ExecuteQuery()
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.