Microsoft-graph-docs: Patch or post ListItem that contains a Multi lookUp

Created on 20 Aug 2018  路  6Comments  路  Source: microsoftgraph/microsoft-graph-docs

It's a simple:
When we want to change a single lookUp it's working like below:

  "fields": {
    "Title": "Lalala",
    "AwesomeDudeLookupId": 42
  }
}

But how can we change a list? For example, I have list hyperlinks that refers to another list:

"fields": {
"TestFields": [
            {
                "LookupId": 175,
                "LookupValue": "175"
            },
            {
                "LookupId": 176,
                "LookupValue": "176"
            }
        ]
}

And when I changed it I got a error like this:

"message": "A value without a type name was found and no expected type is available. 
When the model is specified, each value in the payload must have a type 
which can be either specified in the payload, explicitly by the caller or 
implicitly inferred from the parent value.",

How to resolve this problem?

Most helpful comment

@tsekityam @CaramelHeaven @jthake-msft @mlafleur
I able to post multiple lookupids using following (above StackOverflow ref)

"[email protected]": "Collection(Edm.Int32)",
"ProductsLookupId":[6,7,8]

Where Products is a lookup column to allow multiple values.
I followed suggestion from this stackoverflow reply

All 6 comments

This issues lists is specifically for documentation issues, not the underlying service, sdks or samples. I will close this issue so our documentation team can focus on content issues.
The official channel for questions is StackOverflow with 'microsoft-graph' tag.
For issues, you can raise a support ticket on the Azure Portal where you registered your application. This simple video shows how to file it properly by visiting here.

@jthake-msft Another MS employee @mlafleur said that patch or post list item with multi selection is not supported by MS Graph API nowadays in StackOverflow. I think this limitation needs to be mentioned somewhere in the doc.

This issue should be reopened, and we should have an update to the doc on this topic.

@JeremyKelley we should document which ones aren't supported as per the stack response by @mlafleur .

Unfortunately, a number of column types, including MultiChoice, cannot be updated via Microsoft Graph today

@tsekityam @CaramelHeaven @jthake-msft @mlafleur
I able to post multiple lookupids using following (above StackOverflow ref)

"[email protected]": "Collection(Edm.Int32)",
"ProductsLookupId":[6,7,8]

Where Products is a lookup column to allow multiple values.
I followed suggestion from this stackoverflow reply

@tsekityam @CaramelHeaven @jthake-msft @mlafleur
I able to post multiple lookupids using following (above StackOverflow ref)

"[email protected]": "Collection(Edm.Int32)",
"ProductsLookupId":[6,7,8]

Where Products is a lookup column to allow multiple values.
I followed suggestion from this stackoverflow reply

Many thanks I works for me too !! Genius !!

We do this with a workaround on SharePoint Online REST API

`#region UpdateListItem

GetFormDigest - http://www.pranavsharma.com/blog/2014/06/12/use-powershells-invoke-restmethod-with-the-sharepoint-2013-rest-api/

$headerParams = @{
'Authorization' = "$($oauth.token_type) $($oauth.access_token)"
'Content-Type' = "application/json"
}

[uri]$uriGraphEndpoint = "$baseUri/contextinfo"
$response = Invoke-RestMethod -Method 'Post' -Uri $uriGraphEndpoint.AbsoluteUri -Headers $headerParams -ContentType "application/json; charset=utf-8"
$formDigest = $response.GetContextWebInformation.FormDigestValue #max Valid for 30min

$headerParams.Add("X-RequestDigest", $formDigest)
$headerParams.Add("X-Http-Method", "PATCH")
$headerParams.Add("If-Match", "*")

JSON for Update

$url = @{
"Url" = "https://$spoUrl/sites/$customer" #$siteUrl
"Description" = "https://$spoUrl/sites/$customer" #$siteUrl
}

$itemUpdate = @{
"Title" = $customer
"Url" = $url
"Kundenname" = $customerName
} | ConvertTo-Json

[uri]$uriGraphEndpoint = "$baseUri/web/lists/GetByTitle('$listName')/items($itemId)"
$response = Invoke-RestMethod -Method 'Post' -Uri $uriGraphEndpoint.AbsoluteUri -Headers $headerParams -Body $itemUpdate -ContentType "application/json; charset=utf-8"

endregion UpdateListItem`

Was this page helpful?
0 / 5 - 0 ratings

Related issues

r3dh0t picture r3dh0t  路  4Comments

findyoucef picture findyoucef  路  4Comments

andrewfabrizi picture andrewfabrizi  路  3Comments

tfrancois picture tfrancois  路  3Comments

RobinBreman picture RobinBreman  路  4Comments