3

I'm trying to create new SharePoint ListItem using Microsoft Graph.

To create a list item with simple fields like Title, my POST body looks like:

{
   "fields":{
       "Title":"Ehsan's REST"
   }
}

But as soon as I add a field with the multichoice value I get The request is malformed or incorrect. error.

example:

{
   "fields":{
       "Title":"Ehsan's REST",
       "Languages": ["English","French"]
   }
}

During my search I found this forum post where SharePoint API (not Graph ) requires a metadata attribute to be added to the collection as an object:

"InternalFieldName":{
  "__metadata":{"type":"Collection(Edm.String)"},
  "results":["Value1","Value2","Value3"]
}

There's an open issue on microsoft graph doc github related to this as well.

Any suggestions?

Ehsan Mahpour
  • 131
  • 1
  • 8
  • So we gave up on using Microsoft Graph API for SharePoint to insert or edit list items as there’s not much of support by its community. Switching to direct SharePoint API calls. – Ehsan Mahpour Mar 16 '18 at 01:21
  • At this time, it looks as if choice list items are unable to be created by the Microsoft Graph API: https://stackoverflow.com/questions/50374762/microsoft-graph-update-sharepoint-list-item-multi-choice-field [Here's an open Feature Request Link](https://officespdev.uservoice.com/forums/224641-feature-requests-and-feedback/suggestions/34268581-support-sharepoint-multi-choice-fields-when-updati) – rothkinder Oct 13 '18 at 16:31

2 Answers2

3

You should be able to set the value of multi-choice columns, but you'd have to specify the type of the field to make sure OData understands it:

{
  "fields": {
    "choice_checkboxes@odata.type": "Collection(Edm.String)",
    "choice_checkboxes":["cb1","cb2"]
  }
}
Brad
  • 4,089
  • 2
  • 16
  • 26
2

I am able to post lookup column values using following:

"ProductsLookupId@odata.type": "Collection(Edm.Int32)",
"ProductsLookupId":[6,7,8]

Where Products is a lookup column to allow multiple choice.

user4157124
  • 2,809
  • 13
  • 27
  • 42