Nov 23 2023 11:39 PM
Hello everyone,
I'm currently working on a project where I need to create items in a SharePoint List using Microsoft Graph. While I have successfully managed to create items with text and integer fields, I am facing challenges with hyperlink columns. Specifically, I'm unsure how to construct the object in C# or VB.NET for hyperlink columns, as the documentation I've found mainly covers text and integer fields.
Here's the code snippet from the documentation:
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new ListItem
{
Fields = new FieldValueSet
{
AdditionalData = new Dictionary<string, object>
{
{
"Title" , "Widget"
},
{
"Color" , "Purple"
},
{
"Weight" , 32
},
// Struggling to figure out how to add a hyperlink field here
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Sites["{site-id}"].Lists["{list-id}"].Items.PostAsync(requestBody);
Could anyone provide guidance or examples on how to create objects for hyperlink columns in a SharePoint List using Microsoft Graph? Any references to relevant documentation or best practices would also be greatly appreciated.
Thank you in advance for your assistance!