Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

This is what I have tried so far:

            string newPageXml = String.Format(@"<Batch OnError='Continue'>
                                    <Method ID='1' Cmd='New'>
                                        <Field Name='ID'>New</Field>
                                        <Field Name='ContentType'>MNC Site Page</Field>
                                        <Field Name='Title'>{0}</Field>
                                        <Field Name='BaseName'>{0}</Field>
                                        <Field Name='PublishingPageContent'>{1}</Field>
                                    </Method>
                                </Batch>", "Friday Memo for " + nextFriday.ToShortDateString(), newPageContent);

            xd = new XmlDocument();
            xd.LoadXml(newPageXml);
            newItem = xd.DocumentElement;
            createdItem = ceoList.UpdateListItems("Pages", newItem);

This code create an item in my list, but the item uses the default content type instead of the one I have specified in my XML. Is there a way to do what I am trying above?

share|improve this question
add comment

1 Answer

I see this is a bit of an old question, but it is unanswered so I'll try to offer a possible solution...

You can try to add ContentTypeId field together with ContentType. Does it work now?

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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