cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Kaine
Helper I
Helper I

Can AzureBlobStorage connector create a folder/subfolder for files?

Hi,

Using AzureBlobStorage connector in PowerApps, is it possible to create a folder on the fly?

For example, I would like to group files under the ID of the parent item to which they belong. To be able to do this, I need to create create sub-folders named with the parent ID on the fly.

In my example, I have a Blob storage account with a container called "attachments". Within the "attachments" container, I'd like to check for and create a folder matching the ID of the parent, such as

attachments/20b5b3c2-7493-45ff-b9f9-ab5cccdf644d

I have used the following code, which appears to work, in that the sub-folder is created and the file successfully uploaded, but the execution results in an error:

AzureBlobStorage.CreateFile(Concatenate("attachments/", Parent.Id), "My File.txt", btnAddPicture.Media)

Using the code above results in errors like this:

AzureBlobStorage.CreateFile failed: {
  "status": 404,
  "message": "Specified container 20b5b3c2-7493-45ff-b9f9-ab5cccdf644d does not exist.\r\nclientRequestId: f898671e-78c2-425c-b080-f6d6d1cab5d4",
  "error": {
    "message": "Specified container 20b5b3c2-7493-45ff-b9f9-ab5cccdf644d does not exist."
  },
  "source": "azureblob-we.azconn-we-01.p.azurewebsites.net"
}

 So, in conclusion, the call seems to work, but results in an error. Is there some way that I can avoid this error?

 

Kaine

1 ACCEPTED SOLUTION

Accepted Solutions
v-siky-msft
Community Support
Community Support

Hi @Kaine ,

I made a test on my side and the AzureBlobStorage.CreateFile function creates a subfolder for files without any errors.

Snipaste_2020-05-06_16-30-46.png

Please try to refresh the Azure blob storage Connection and format the folder path as '/Container/SubFolder/'.

AzureBlobStorage.CreateFile(Concatenate("/attachments/", Parent.Id,"/"), "My File.txt", btnAddPicture.Media)

Hope this helps.

Sik

 

 

 

 

View solution in original post

2 REPLIES 2
v-siky-msft
Community Support
Community Support

Hi @Kaine ,

I made a test on my side and the AzureBlobStorage.CreateFile function creates a subfolder for files without any errors.

Snipaste_2020-05-06_16-30-46.png

Please try to refresh the Azure blob storage Connection and format the folder path as '/Container/SubFolder/'.

AzureBlobStorage.CreateFile(Concatenate("/attachments/", Parent.Id,"/"), "My File.txt", btnAddPicture.Media)

Hope this helps.

Sik

 

 

 

 

View solution in original post

Hi @v-siky-msft ,

Yes, I think that it must have been the trailing slash (/). It all works without complaint now.

Thanks ever so much for your help.

 

- Kaine

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,262)