Knowledge Center

15 Apr, 2024

Create SharePoint list items using the Microsoft Graph API and Azure Functions locally

Posted on 15 Apr, 2024 by Ankit Gore, Posted in Azure Function


In this blog, we will explore how to create SharePoint list items using the Microsoft Graph API and Azure Functions locally. 

Many developers prefer a local development experience. When you use Functions, using your favorite code editor and development tools to create and test functions on your local computer becomes easier. Your local functions can connect to live Azure services, and you can debug them on your local computer using the full Functions runtime.

You can find more details about this over here:


  1. Visual Studio 2022, with the Azure development workload installed.
  2. Register a new app on Azure if not already done.
    • Make a note of the Client ID, client secret of the app, and the tenant ID of the Azure portal.
  3. SharePoint list ID and site ID are also required.

Steps to perform:

  1. Create a new Azure function(HTTP trigger) project in Visual Studio 2022.


  1. Folder structure
    • Below, we created a 'Common' folder and added the 'common.cs' file inside it for common functions.


  1. Let's write the code.
    declare the global variables.

  2. Set the values of the global variable and call the function to get the Graph client.
  3. Add the 'get graph client' function in the common file
  4. Create the static dummy JSON data to insert in SharePoint list.

  1. Now deserialize the JSON data and create the class file for the item.


  1. Create request body for each item.


  1. Now, create an item using the request body inside the foreach loop.
    var result = graphClient.Sites[""].Lists["f93896fc-0672-4844-97a7-b334d1ed3771"].Items.PostAsync(requestBody);
  2. Return the response at the end.


  1. Output
    SP list:

Hope you find this helpful!!


This is a Required Field


Recent Updates

16 Jul, 2024

How to use Solutions with Power Pages

What is Solution in power Pages? A solution is a container for components such as Website Configuration and Dataverse Components.…

15 Jul, 2024

Create a Dataverse table with a SharePoint List

In today’s business world, Organization uses SharePoint lists for document management, and data storage. Let's assume a scenario where an organization…

Case Study BW - Nebulaa IT Solutions
Case Study
03 Jul, 2024

Revolutionizing Build Warranty's Operations with a Scalable and Automated Dynamics 365 Solution

Customer Overview Build Warranty (BW), a leading UK-based provider of warranty solutions for the construction industry, sought a strategic partner…