This is my third blog post in the Automating SharePoint Online using PowerShell + CSOM Series. In the last article we saw how to authenticate against SharePoint Online site and how to access Web and List using PowerShell + CSOM. Here is the blog post.
Automating SharePoint Online Tasks (O365) using PowerShell + CSOM – Part 1
Automating SharePoint Online Tasks (O365) using PowerShell + CSOM – Part 2
Just reiterate, we are going to create site columns and content types and then adding site columns to content type and then finally adding content type to list.
So in this blog post I am going to show you how to write a code to create a Content Types using PowerShell and CSOM.
# ......START Authenticate....................
.\1_Authenticate.ps1
#........END Authenticate.....................
#...POST SP1 use the following If you are using SP 2013 RTM or anything prior to SP1 then you cannot assign Content Type ID.
# SharePoint will assign the ID automatically. You only have to assign Parent Content Type ID like I have done above.
#But if you are using SP1 then You can assign your own ID.
#$cType.Id = "0x0101.......";
#Set content type to be avaialble from specific group
$cType.Group = "SPSBoston Content Types";
#Create the content type
$spsBostonCT = $contentTypes.Add($cType);
$ctx.ExecuteQuery();