web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How do I create a list...
Power Automate
Unanswered

How do I create a list item in a folder using Flow?

(0) ShareShare
ReportReport
Posted on by
How do I create a list item in a folder using Flow?
I tried to create an item with "ListItemCreationInformationUsingPath" using "Send an HTTP request for SharePoint".
But that didn't work.
”BadGateway” (Status code : 502) was output and it did not work properly.
 
Does anyone have a solution?
Thank you.
---
The details of the error are as follows.
{
 "error": {
 "code": 502,
 "source": "japan-001.azure-apim.net",
 "clientRequestId": "94444f1f-c173-4841-b9ae-cb45d8abb436",
 "message": "BadGateway",
 "innerError": {
 "status": 502,
 "message": "There is no file with URL '<SiteURL>/Lists/TestListB/SubFolder/' on this web. \r\nclientRequestId: 94444f1f-c173-4841-b9ae-cb45d8abb436\r\nserviceRequestId: 831e099f-60d1-9000-ab61-4f7822954e56",
 "source": "<SiteURL>/_api/web/lists/GetByTitle('TestListB')/AddValidateUpdateItemUsingPath",
 "errors": [
 "-2130245370",
 "Microsoft.SharePoint.SPException"
 ]
 }
 }
}
 
The details of the Request are as follows.
Uri: 
/_api/web/lists/GetByTitle('TestListB')/AddValidateUpdateItemUsingPath
Headers:
{
"Accept": "application/json;odata=verbose",
"Content-Type": "application/json;odata=verbose"
}
Body:
{
 "listItemCreateInfo": {
 "FolderPath": {
 "DecodedUrl": "<SiteURL>/Lists/TestListB/SubFolder/"
 },
 "UnderlyingObjectType": 0
 },
 "formValues": [{
 "FieldName": "Title",
 "FieldValue": "made from REST"
 }],
 "bNewDocumentUpdate": false
}

 

The SharePoint List are as follows.

forFLowPNG.PNG

Categories:
I have the same question (0)
  • v-alzhan-msft Profile Picture
    on at
    Re: How do I create a list item in a folder using Flow?

    Hi @Anonymous ,

     

    The files are saved in the sharepoint library, there are not save in the sharepoint list.

    Please refer to link below to learn more about working with folders in sharepoint library:

    https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-folders-and-files-with-rest

     

    Best regards,

    Alice       

     

    Community Support Team _ Alice Zhang
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • Gristy Profile Picture
    2,429 on at
    Re: How do I create a list item in a folder using Flow?

    Alice, please make sure you read the OPs request first in full.

     

    he has enabled folders on a list not a library and would like to create the items inside the folder that has been created.

     

    I think the issue you are facing is that the REST API does not have complete support for folders.

     

    Try creating the item using normal create item sharepoint action in the root of the list and then doing your REST call using the MoveTo operation to move inside the folder.

     

    I will give this a go and let you know if i can get it to work.

     

  • Verified answer
    Gristy Profile Picture
    2,429 on at
    Re: How do I create a list item in a folder using Flow?

    Hey,

     

    The process is as follows.

    1) Create a List Item and Get its ID

    2) Grab that Items FileRef and FileLeafRef

    3) Move the Item to the desired folder.

     

    In my screenshots below i have passed in a ID of a list item manually, but you would do that dynamically.

     

    screencapture-australia-flow-microsoft-manage-environments-Default-f644d653-a41f-4eb9-9d7e-d0d8c187faa0-flows-new-2019-09-30-14_25_22.png

     

    Here is the schema you will need for the Parse JSON Step:

    {
    "type": "object",
    "properties": {
    "FileRef": {
    "type": "string"
    },
    "FileLeafRef": {
    "type": "string"
    }
    }
    }
  • Community Power Platform Member Profile Picture
    on at
    Re: How do I create a list item in a folder using Flow?

    Hi, @Gristy

     

    Thank you for your reply!

    I tried your solution immediately. However, there was another problem with the "moveto" process.

     

    Does it occur in your flow shown?

    {
     "status": 403,
     "message": "{\"odata.error\":{\"code\":\"-2147024891, System.UnauthorizedAccessException\",\"message\":{\"lang\":\"ja-JP\",\"value\":\"\\u30a2\\u30af\\u30bb\\u30b9\\u304c\\u62d2\\u5426\\u3055\\u308c\\u307e\\u3057\\u305f\\u3002\\u3053\\u306e\\u64cd\\u4f5c\\u306e\\u5b9f\\u884c\\u6a29\\u9650\\u307e\\u305f\\u306f\\u3053\\u306e\\u30ea\\u30bd\\u30fc\\u30b9\\u306e\\u30a2\\u30af\\u30bb\\u30b9\\u6a29\\u304c\\u3042\\u308a\\u307e\\u305b\\u3093\\u3002\"}}}\r\nclientRequestId: 57944b2f-7967-4e30-b58d-8382b9f85159\r\nserviceRequestId: cb39099f-60be-9000-7e53-ea98704c8d40",
     "source": "<SiteURL>/_api/Web/getFileByServerRelativeURL('/sites/Site01/Lists/TestListB/199_.000')/moveTo(newurl='/sites/Site01/Lists/TestListB/SubFolder/199_.000',flags=1)",
     "errors": []
    }

    Do you need any other settings?

    By the way, the user who runs Flow is the administrator of the SharePoint site collection.

     

     

  • Gristy Profile Picture
    2,429 on at
    Re: How do I create a list item in a folder using Flow?
    Please provide pictures - and no mine executed with success
  • Community Power Platform Member Profile Picture
    on at
    Re: How do I create a list item in a folder using Flow?

    @Gristy 

    thank you for your reply.

    Here is the image... Sorry, part of the display is in Japanese.

    2019-09-30 183704.jpg

    I tried to enter "Content-Type", but there was no change.

  • Gristy Profile Picture
    2,429 on at
    Re: How do I create a list item in a folder using Flow?
    Looks ok to me. Check the connection the actions are using to be sure it is the correct user. I will take a closer look when I am on a computer too
  • Verified answer
    Community Power Platform Member Profile Picture
    on at
    Re: How do I create a list item in a folder using Flow?

    @Gristy 

    Thank you very much for your support.

    I will investigate the connection and other.

    Please let me know if you notice anything else.

     

    Thanks.

  • Samiullah Profile Picture
    11 on at
    Re: How do I create a list item in a folder using Flow?

    Hey @Anonymous ,

    "DecodedUrl": "<SiteURL>/Lists/TestListB/SubFolder/"

    just replace <SiteURL> with your SiteURL then it will  work fine, I tried and its working.

    For Example,
    flow2.PNG

     

    flow1.PNG

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 462 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 456 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard