Hi,
I am not able to add existing columns in my library to the newly created document set using COM.
I am able create DS but want to add lib colunns in that DS. Pls refer below code:
ContentTypeCollection conCollectionList = Mylib.ContentTypes;
ClientContext.Load(conCollectionList);
ClientContext.Load(conCollectionList, l => l.Include(t => t.Parent.Id, t => t.Fields.Include(p => p.InternalName)));
//Adding DS id= 0x0120D520 to lib
ContentType cTypeParent = ClientContext.Site.RootWeb.AvailableContentTypes.GetById("0x0120D520");
var ctTYpeCreationInfo = new ContentTypeCreationInformation();
ctTYpeCreationInfo.ParentContentType = cTypeParent;
ctTYpeCreationInfo.Name = "New DS";
ctTYpeCreationInfo.Group = "Document Set Content Types";
ctTYpeCreationInfo.Description = "Document set Content Type";
ContentType contentType = conCollectionList.Add(ctTYpeCreationInfo);
ClientContext.ExecuteQuery();
// Below code is not working to add field link to DS and getting "error: The content type has no children"
var field = Mylib.Fields.GetByInternalNameOrTitle("Status");
var fieldLink = new FieldLinkCreationInformation();
fieldLink.Field = field;
contentType.FieldLinks.Add(fieldLink);
contentType.Update(true);
ClientContext.ExecuteQuery();
Thanks in advance!