0

how do i update complex fields like person/Group, Taxonomy, Lookup in rest api?

any code samples would definitely help me?

2
1

Update User field("UserField")

Multiple user field value:

var item = {
    '__metadata' : { 'type': 'SP.Data.TestListItem' },
    'UserFieldId' : { 'results': [10,11] }
};

Single user field value:

var item = {
    '__metadata' : { 'type': 'SP.Data.TestListItem' },
    'UserFieldId' : 10
};

Update Lookup field("LookupField")

var item = {
    '__metadata' : { 'type': 'SP.Data.TestListItem' },
    'LookupFieldId' : 1
};

Update Managed Metadata field("MyTaxonomyField")

var metaObject={
    '__metadata': { 'type': 'SP.Taxonomy.TaxonomyFieldValue' },
    'Label':'<YOUR LABEL>',
    'TermGuid':'<YOUR TERM GUID>',
    'WssId': -1
}
var item = {
    '__metadata' : { 'type': 'SP.Data.TestListItem' },  
    'MyTaxonomyField' : metaObject
};

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.