Forum Discussion

devswithabid's avatar
devswithabid
Copper Contributor
Dec 26, 2024

Sharepoint Lists: Format for POST Request to create Column as Choice with Multi Select Enabled

I am relatively new in using the Graph API. I am working on a script that creates new columns for an existing List on my company's SharePoint site. I am having trouble in creating a Choice Field Column that has Multiple Selection Enabled. I followed the documentation to create a Choice Field with the default (single select) as follows:

const apiUrl = `https://graph.microsoft.com/v1.0/sites/${siteId}/lists/${listId}/columns`;
const response = await fetch(apiUrl, {
    method: "POST",
    headers: {
            Authorization: `Bearer ${accessToken}`,
            "Content-Type": "application/json",
    },
    body: JSON.stringify(columnPayload),
});

Where, columnPayload looks like the following:

{
  "name": "Color",
  "choice": {
    "choices": ["Red", "Green", "Blue", "Purple"],
    "displayAs": "dropDownMenu"
  }
}

As expected I see the column created properly.... (Split bottom photo for cleaner view)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Now, what changes must I make to have the Allow Multiple Selections toggle enabled when creating the column via the POST request.

 

 

 

 

 

 

 

 

 

 

 

 

 

As we can see, by default, it is not enabled. 

I have looked over the documentation and have yet to come across anything that provides a solution. I assumed there would be additional fields within the "choice" field in the JSON body to specify this, however, I only see the following on the graph api site:

I would appreciate any guidance on this. 

No RepliesBe the first to reply

Resources