cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
elaaadani
Helper V
Helper V

Create an item inside a folder in sharepoint list

Hello,  good afternoon to everyone.
Is there any way to create an item in a sharepoint list inside a folder ?
That is, I have a list with a B folder and I need to create an item inside the B folder. I know there is a request for this to be possible, but I would like to know if it can be done in some way.
Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Super User
Super User

Hi @elaaadani,

 

This should be possible by using the Send an HTTP request to SharePoint action together with a REST API post request: https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-lists-and-list-items-with-re...

 

Use the following URI:

_api/web/lists/GetByTitle('@{variables('ListName')}')/AddValidateUpdateItemUsingPath

 

Add for example this to the body of the request. 

{
  "listItemCreateInfo": {
    "FolderPath": {
      "DecodedUrl": "@{variables('SubFolderUrl')}"
    },
    "UnderlyingObjectType": 0
  },
  "formValues": [
    {
      "FieldName": "Title",
      "FieldValue": "Item in Folder"
    }
  ],
  "bNewDocumentUpdate": false
}

 

Place the path to your sub folder in the DecodeUrl property of the body. The format of your url should be something like this:

 

https://contoso.sharepoint.com/sites/@{variables('SiteName')}/lists/@{variables('ListName')}/@{variables('FolderName')}

 

 

 

createlistiteminfolder.png

 

Hope this helps a bit.



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


View solution in original post

4 REPLIES 4
Expiscornovus
Super User
Super User

Hi @elaaadani,

 

This should be possible by using the Send an HTTP request to SharePoint action together with a REST API post request: https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-lists-and-list-items-with-re...

 

Use the following URI:

_api/web/lists/GetByTitle('@{variables('ListName')}')/AddValidateUpdateItemUsingPath

 

Add for example this to the body of the request. 

{
  "listItemCreateInfo": {
    "FolderPath": {
      "DecodedUrl": "@{variables('SubFolderUrl')}"
    },
    "UnderlyingObjectType": 0
  },
  "formValues": [
    {
      "FieldName": "Title",
      "FieldValue": "Item in Folder"
    }
  ],
  "bNewDocumentUpdate": false
}

 

Place the path to your sub folder in the DecodeUrl property of the body. The format of your url should be something like this:

 

https://contoso.sharepoint.com/sites/@{variables('SiteName')}/lists/@{variables('ListName')}/@{variables('FolderName')}

 

 

 

createlistiteminfolder.png

 

Hope this helps a bit.



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


Hi @Expiscornovus thank you very much for answering me. It worked perfectly. I thank you for it !

Hi! I tried this solution with a simple list called "Teste" and received the massage "BadGateway". Power Automate keep on trying, but receives the same message:

Meriguetti_2-1652447667331.png

 

Command and variables:

 

Meriguetti_4-1652448370249.png

 

Meriguetti_3-1652447797373.png

List:

Meriguetti_5-1652448526017.png

Thanks in advance!

 

Hi,

 

I've got the same error> Bad gateway

 

Then I realized, that I didn't put the whole URL address to FolderPath DecodedUrl, just the name of the folder.

After correction  everything works fine.

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (2,598)