cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
boca
Level: Powered On

Move or rename file in OneDrive for Business: Error 409 - specified item name already exists

Hello everybody

 

I've got a problem using Flows with PowerApps. I try to move some Files into another folder and rename them. For some files, it shows 

{
  "status": 409,
  "message": "The specified item name already exists.",
  "source": "api.connectorp.svc.ms"
}

 

Background:

I created a PowerApp, which lets the user take some photos, saves them to OneDrive for Business and sends an E-Mail to a specific address. To save the images, I use a FORALL(Collection, BATCH(...)) directly in PowerApps, where the images are saved in OneDrive using an Excel file. After this, the Flow is started. It takes some information from PowerApps and sends the E-Mail. This works fine until here. Complete flow looks like this:

image.png

 

The marked steps are the problematic part. My plan is to List all files in the folder, check for all, if they are a folder and, if not, move and rename the file into a subfolder with an variable name taken from the PowerApp. The new file should get a name concated from PowerApp variables and an utc_timestamp to make it unique. 

image.png

 

The filename is unique, however sometimes (not always) I get following error:

image.png

 

I would really appreciate any help. I hope the German UI is no problem.

Thank you and best regards

Patrick

1 ACCEPTED SOLUTION

Accepted Solutions
boca
Level: Powered On

Re: Move or rename file in OneDrive for Business: Error 409 - specified item name already exists

Thank you for your reply and your help. The Do until solution is not possible here, since it needs the folder output to be in an Apply to each-Loop to iterate through the files.

However, I changed the filename to use the original file's id instead of the timestamp. It works fine for now.

View solution in original post

2 REPLIES 2
Community Support Team
Community Support Team

Re: Move or rename file in OneDrive for Business: Error 409 - specified item name already exists

Hi @boca,

 

Thanks for the feedback.

Usually this error messge would occur when the file (with the same name) already exists in the destination, I saw the file name is configured with the same parameter passed from PowerApps trigger, adding the UTCNow() action.

Things should be take notice of is within the Apply to each, every single item is performed in parallel, which means the Rename/Move action may happen for two or multiple items at the same time.

 

 

There are ways to workaround this, could either through PowerApps or Microsoft Flow.

For Microsoft Flow, we could switch to the Do until action, then take use of variable (recording the number of the items in OneDrive body), then set the variable to decrease until value equals to 0.

 

Within PowerApps, we need to specify something specific for every item, generating a rendom number with rand() function, then pass it into Flow under the destination File path field.

 

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
boca
Level: Powered On

Re: Move or rename file in OneDrive for Business: Error 409 - specified item name already exists

Thank you for your reply and your help. The Do until solution is not possible here, since it needs the folder output to be in an Apply to each-Loop to iterate through the files.

However, I changed the filename to use the original file's id instead of the timestamp. It works fine for now.

View solution in original post

Helpful resources

Announcements
firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Solution Authors
Top Kudoed Authors
Users online (4,458)