如何在Microsoft Flow中创建每日运行的OneDrive个人版文件夹移动流?是否支持移动文件夹操作?
Absolutely, you can totally build a daily automated flow to move entire folders in OneDrive Personal—let me walk you through exactly how to pull this off, since the folder-move action is easy to miss if you’re only looking at file-focused operations.
Start by adding the Recurrence trigger to your flow:
- Configure it to run Once per day, and pick the specific time you want the flow to execute (e.g., 2 AM when usage is low to avoid conflicts).
Power Automate relies on a folder’s unique ID for reliable moves (paths can break if folder names change), so grab this first:
- Add the Get folder metadata action from the OneDrive Personal connector.
- In the Folder path field, enter the full path of the folder you want to move (e.g.,
/Projects/Completed/2024-Q1). - This action will output the folder’s
id—you’ll need this value for the next step.
Here’s the hidden gem you might have overlooked: the OneDrive Personal connector has a dedicated folder-move action:
- Add the Move folder action (look under the "Folder" group of actions, not just file-focused options).
- For Folder to move, select the
idfrom the "Get folder metadata" action (use the dynamic content panel to pick this automatically). - For Destination folder, either enter the full path of your target folder (e.g.,
/Archives/Projects/2024) or fetch the target folder’sidwith another "Get folder metadata" action (this is more robust if you anticipate path or name changes).
If for some reason the "Move folder" action isn’t available in your environment, use the Graph API via an HTTP action:
- Add the HTTP action.
- Set Method to
PATCH. - Set URI to
https://graph.microsoft.com/v1.0/me/drive/items/{source-folder-id}(replace{source-folder-id}with the ID from step 2). - Add a header with key
Content-Typeand valueapplication/json. - Paste this JSON in the Body (replace
{target-folder-id}with your destination folder’s ID, fetched via another "Get folder metadata" action):{ "parentReference": { "id": "{target-folder-id}" } } - Use Delegated authentication linked to your OneDrive account to ensure the request has the necessary permissions.
- Test the flow manually first to confirm the entire folder structure (including subfolders and all files inside) moves correctly.
- Add a "Condition" action after step 2 to check if the source folder exists—this prevents failed runs if the folder is already moved or deleted.
内容的提问来源于stack exchange,提问作者Krystian

