0

I am trying to create generic content type creation using following code.

// Create a Content Type Information object
                ContentTypeCreationInformation _customcontenttype = new ContentTypeCreationInformation();
                _customcontenttype.Name = SourceCT.Name;
                _customcontenttype.ParentContentType = TargetContentTypes.GetById(SourceCT.Parent.Id.ToString());//.Parent;
                _customcontenttype.Group = SourceCT.Group;

                // Create the content type
                ContentType myContentType = TargetContentTypes.Add(_customcontenttype);
                Global.targetClientContext.ExecuteQuery();

This code is generating content type properly, but it's not setting parent properly. It always set 'item' as in parent of content type.

Please help.

1
  • What is SourceCT and what is it's Parent that you use as parent? May 31, 2012 at 17:53

1 Answer 1

0

This i have achieved by creating recursive function. Which checks and create parent content type if it's not exist.

1
  • Please can you add some sample code to your post. Without this it isn't really very helpful. Thanks [moderator]
    – SPDoctor
    Jun 12, 2012 at 11:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.