0

I already asked a question here: enter link description here I wanted to retrieve the x-requestdigest from sharepoint to make list-operations just using postman. The provided solution worked great to do some GET-Commands! I get my list data in XML-format.

Now i'm facing a problem when trying to update a list item in postman. What i do: i use the same endpoint like in the get-request to update the listitem, so: https://mytenantname.sharepoint.com/_api/Web/lists/getbytitle('mylist')/items(id) or https://mytenantname.sharepoint.com/_api/Web/lists(guid'my_guid')/items(id)

The body content of my request i took from the following link: how-do-i-update-a-hyperlink-field-using-the-rest-api

    {
    '__metadata': { 'type': 'SP.Data.mylistListItem' },
    'myhyperlinkcolumn': 
            {
                '__metadata': { 'type': 'SP.FieldUrlValue' },
                'Description': 'some_description',
                'Url': 'https://anyurl.com'
            }
    }

I always get a Microsoft.SharePoint.Client.InvalidClientQueryException. The Errormessage always says that the field __metadata does not exist in the functions GetByID or GetByName. Even when i try to update just another normal string-field, i get the same errormessage including the name of the concerning fieldname. I also tried to send my request with the xml i retrieved from the get-command containing the new update values, but this seems not to be the right way.

Does anyone have an idea what i do wrong? None of the solutions i found on StackExchange worked for me, so it may be possible that updates also don't seem to be straight forward when not using the .NET-framework? Thanks for a reply!

0

Ok i found the solution on how-to-update-sharepoint-list-items

I fixed the problem by adding two more header entries: IF-MATCH = * and X-HTTP-Method = MERGE

Now the updates are working fine!

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.