Add existing content type directly to SPO list using Powershell

A short script to add an existing site content type directly to a SharePoint Online list. The script is fully described in an article here:

1,158 times
Add to favorites
Office 365
E-mail Twitter Digg Facebook
  • Unknown Error
    4 Posts | Last post November 13, 2016
    • Hello,
      I tried using script to add a existing content type to one of the document library, but I am getting "Unknown Error" on "Execute Query" call within try block. 
      Any idea what is the possibility?
    • Hi,
      Thank you for using the script. Unknown error is a very general message. 
      1. Are you using the correct list title? Do you receive the same error with another list?
      2. Are you using the correct content type id? Do you receive the same error with another content type?
      3. Is the content type on the same site as the list? Can you add it manually?
      I will be looking forward to your answer.
    • Hello Shashi,
      I had the same problem and I changed this line from:
      and it worked!
      Hope it helps
    • Thanks beckham_girl. 
      I am sure it will be helpful to other users.