1

I have one xml in which all the declaration of the content type are added like

<ContentTypes>
<!-- All Content Type Declarations -->
</ContentTypes>

I can't use sandbox solution for that, so I want to achieve only using client object model c#.

I found one blog which shows exactly what I want but using server object model but I want it using client object model.

Is there any way to create content type like Fields.AddFieldAsXml, so that I can create content type directly by passing xml?

1

You can use the ContentType.Add() method, as shown in this example from Microsoft: https://msdn.microsoft.com/library/office/microsoft.sharepoint.client.contenttypecollection.add.aspx

Unfortunately, this method doesn't take xml, so you will have to use something like XDocument or XPathDocument to parse the xml, and then set the relevant fields of the ContentTypeCreationInformation.

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.