In this blog, we will learn how we can create items in a folder of the SharePoint list.

Follow the below steps to create an item in the folder.

SharePoint-2013-Hosting

Steps

Step 1

First, we will create JSON for the data parameter of POST call as below,

  • Here path will be the server relative path of the list folder in which we want to create an item.
  • In the above JSON, the list name is Projects and there is one folder created with the name Internal.

Step 2

We will also define 2 other variables for site URL and list name.

C#

Here I have created a property for context and assign value to context property as below,

Step 3

Now we will create a URL for API as below,

Step 4

Now we will create a separate method to create an item, so we can also reuse it,

Step 5

As we are doing the POST call to create an item, we need a request digest. So, we will get a request digest from context as below.

We will import libraries to get the request digest as below,

Then we can get the request digest and use it in our POST call to create an item,

In the above code, we can see, after getting the value of the request digest we have to call our method to create the item. So we will call this method as below,

Conclusion

This is how we can create items in a folder of the SharePoint list. Hope this blog will be helpful!