3

I want to update the content type of a list item. When I try to send content type name or content type id as a normal Field, it throws the following exception.

A 'PrimitiveValue' node with non-null value was found when trying to read the value of a navigation property; however, a 'StartArray' node, a 'StartObject' node, or a 'PrimitiveValue' node with null value was expected

Please help me with this. Thanks in Advance!

4
  • What are you trying? Can you provide the code you are using?
    – wjervis
    Nov 22, 2016 at 13:20
  • Actually, I'm using my own form which has a Combobox, that passes the contentType ID. With that value, I wanted to update the list item. So in request stream of HTTPwebRequest I'm passing {'__metadata':{'type':'SP.Data.Jul4ListItem'},'Title':'test','try':'fddata', 'pplId':11,'ContentType':'0x01000D2F316B81461947BCF69E20750971AA'}} which has the Content Type ID. But without contentType id, it updates perfectly but with the base content type 'Item'. Nov 22, 2016 at 13:35
  • 1
    Have you tried this? "ContentTypeId": "0x01000D2F316B81461947BCF69E207509‌​71AA"
    – wjervis
    Nov 22, 2016 at 13:40
  • That's Wow. ya I'm passing ContentTypeId only right. It worked. Timely helped. Thanks:) Nov 22, 2016 at 13:47

1 Answer 1

4

Use ContentTypeId instead of ContentType:

{
    '__metadata':{'type':'SP.Data.Jul4ListItem'},
    'Title':'test'‌​,
    'try':'fddata', 
    'pplId':11, 
    'ContentTypeId':'0x01000D2F316B81461947BCF69E207509‌​71AA'
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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