Hi I am creating my own content types and assigning them to my new lists like so
var contentType = clientContext.Web.ContentTypes.GetById(ContentTypeID);
list.ContentTypesEnabled = true;
list.ContentTypes.AddExistingContentType(contentType);
This works well, however, I do not need to have the default content type attached to these lists. See below.
How can I remove it via code?
Researching more into it, I now know there is a variable called UniqueContentTypeOrder
and I try to apply the new content type ID I want on to it. For example.
IList<ContentTypeId> ctoFolder = new List<ContentTypeId>();
ctoFolder.Add(contentType.Id);
list.RootFolder.UniqueContentTypeOrder = ctoFolder;
list.RootFolder.Update();
list.Update();
clientContext.ExecuteQuery();
However, when executing the query I am getting an "Unknown error" in the catch
Any ideas?
Thanks