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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Error when trying to c...
Power Automate
Suggested Answer

Error when trying to create folder in SharePoint list

(3) ShareShare
ReportReport
Posted on by 792
I am trying to create a folder in a SharePoint list with the variable name varEmpID
 
Got the error, BadGateWay: "Object reference not set to an instance of an object", for the "Create new Folder" action.
I have the same question (0)
  • Suggested answer
    Vahid Ghafarpour Profile Picture
    781 Super User 2026 Season 1 on at
    Did you check invalid characters in folder name like /\?*
  • Kalathiya Profile Picture
    1,555 Super User 2026 Season 1 on at
    Hello @rpersad
     
    Could you please confirm below things?
     
    #1.If you are creating the folder in a SharePoint list then
    Make sure that you have enabled the folder in list setting
    - Go to list setting
    - Open Advanced Setting
    - Ensure "Make ‘New Folder’ command available" is set to Yes
     
     
    #2. Please confirm that the variable value (varEmpID) is not empty.
     
    #3. If you are using the variable in the folder path, make sure it does not contain any special characters like . , ' , " , \ , # , $ , %
    You can refer to this guide to remove special characters if needed:
     
    #4. Update the new connection and try, might be temporary issue.
     
    If this response resolves your issue, please mark it as the Verified Answer so it can help other community members as well.
    ---------------------------------------------------------------------------------

    📩 Need more help? Just mention @Kalathiya and I’ll be happy to assist.

    ✔️ If this answer helped you, please tick “Does this answer your question?” so it can be marked as the Verified Answer.

    💛 A Like always motivates me to keep contributing!

     
     
     
  • Suggested answer
    Haque Profile Picture
    849 on at
     
    I am sure you are using PowerAutomate to create folder in "SharePint"  list. I am not sure what the requirement is but from the basic ground - Create Folder or folder creation in SP list is only for a capability to organize list items hierarchically. To me, there is nothing you can store in this folder after creating it like files, media etc.
     
    One other thing is, Create new folder action in PowerAutomate is designed for libraries where we can create folders and nested folders. 
     
    It would be better if could share the signature of endpoint call. However, I have assumed you have used Create new folder action, let's use HTTP request instead.
     
     
    Probably HTTP action ( SharePoint → Send an HTTP request to SharePoint) will work with this endpoint call.
    POST /_api/web/lists/getbytitle('YourListName')/items
    
     
    {
      "__metadata": { "type": "SP.ListItem" },
      "FileLeafRef": varEmpID,
      "FSObjType": 1
    }
    
    FileLeafRef: the folder name (your variable, e.g., variables('varEmpID')). FSObjType: 1 means folder, 0 means item.
     
    Besides, I would suggest if you check the permission stuff mention here.
     

    I am sure some clues I tried to give. If these clues help to resolve the issue brought you by here, please don't forget to check the box Does this answer your question? At the same time, I am pretty sure you have liked the response!
     
  • rpersad Profile Picture
    792 on at
    @Vahid Ghafarpour I can confirm there are no invalid characters and the variable "varEmpID" is a string.

    @Kalathiya 
    #1 I have confirmed that the "Make ‘New Folder’ command available" is set to Yes 
    #2 varEmpID is not empty
    #3 no special characters are in the folder path


    @Haque I have used the "Create New Folder" action to create folders in another SharePoint list. The purpose is to organize records by Employee ID into folders. Will try your suggestion to see if that works.
  • Kalathiya Profile Picture
    1,555 Super User 2026 Season 1 on at
    Hello @rpersad
    Thanks for confirming.  Could you please try to change the connection and try again then?
  • Suggested answer
    Valantis Profile Picture
    1,922 on at
     
    The Create New Folder action is designed for SharePoint document libraries, not lists.
    That is what is causing the BadGateway error.
    The fix is to replace it with SharePoint → Send an HTTP request to SharePoint using this call:
     
    POST /_api/web/lists/getbytitle('YourListName')/items
    {
      "__metadata": { "type": "SP.ListItem" },
      "FileLeafRef": "variables('varEmpID')",
      "FSObjType": 1
    }
    FSObjType set to 1 tells SharePoint to create a folder. Replace YourListName with your actual list name.
     
    Let me know if it works.
     

     

    Best regards,

    Valantis

     

    ✅ If this helped solve your issue, please Accept as Solution so others can find it quickly.

    ❤️ If it didn’t fully solve it but was still useful, please click “Yes” on “Was this reply helpful?” or leave a Like :).

    🏷️ For follow-ups  @Valantis.

    📝 https://valantisond365.com/

     

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 293

#2
David_MA Profile Picture

David_MA 262 Super User 2026 Season 1

#3
Expiscornovus Profile Picture

Expiscornovus 223 Most Valuable Professional

Last 30 days Overall leaderboard