I am developing a PowerShell Script and this script is supposed to do following task:
- Create a Document Library (E.g. Financian Documents)
- Attach a Content Type to this Document Library
- Setup this Content Type as a Default Content Type
I am stuck at third point and not able to setup default content type using PowerShell. Here is the code that I am using to update Content Type:
Code
$ctidary = New-Object System.Collections.Generic.List[Microsoft.SharePoint.Client.ContentTypeId]
$ctidary.insert($ctID)
$list.rootfolder.uniquecontenttypeorder = $ctidary
$list.rootfolder.update()
$clientContext.executeQuery()
Error
Cannot find an overload for "insert" and the argument count: "1"
Please suggest me how can I set up a Content Type as a default Content type for a Document Library in SharePoint Online using Powershell Script.
Thanks in advance!