Sep 09 2020 07:55 PM - edited Sep 09 2020 07:56 PM
I am trying to create a flow to copy a file from a folder in a Document Library (called Master) to a folder with the same name in a different Document Library (called Draft) and if possible using part of the Folder Name as a variable - /Master/01 Folder A - is this possible?
My flow is as follows so far and works until the last Copy File step:
For a selected file (Site Address: https://contoso.com/Site, Library Name: Master)
Get file properties (Site Address: https://contoso.com/Site, Library Name: Master, Id: ID)
Initialize variable (Name: FileID, Type: String, Value: https://contoso.com/Site/FullPath)
Get file metadata using path (Site Address: https://contoso.com/Site, File Path: FileID)
...and here's where I have trouble with the Destination Site Address and Folder
Copy file (Current Site Address: https://contoso.com/Site, File to Copy: FileID, Destination Site Address: https://contoso.com/Site, Destination Folder: /Drafts/XXX
Is there a way I can use an expression to get part of the Folder Path from previous steps to fill in.
For example, if I was copying a file from Folder Path: Master/01 Folder A/, is there an expression I can use to extract just the 01 Folder A part of the string to fill in the Destination Folder so when it ran, the Destination Folder would essentially show as /Drafts/%variable% and result in /Drafts/01 Folder A or if I ran the flow from Master/02 Folder B, the Destination Folder would know the path is /Drafts/02 Folder B.
Sep 09 2020 10:05 PM
I've just tried to use Get Folder Metadata step and I can see the correct values in Name and DisplayName but when I try to use this as a variable in the Copy File step as Destination Site address: https://contoso.com/Site, Destination Folder: /Drafts/DisplayName it throws a Failed to verify the existence of source object at error.
Sep 09 2020 11:23 PM
SolutionSolved after some more work!
Created a Get Folder Metadata step
Created an Initialize Variable called FolderID, type: String, Value: DisplayName (from Get folder Metadata)
The last Copy file:
Current Site Address: https://contoso.com/Site
File to copy: Identifier (from Get Item)
Destination Site Address: https://contoso.com/Site
Destination Folder: /Drafts/FolderID (variable)
Horray!
Feb 23 2024 08:21 AM
@albertstainI do not have Get Folder Meta in my available actions within OneDrive for Business... where is the Get Folder Meta Action ? can you provide a screenshot ? thanks
Sep 09 2020 11:23 PM
SolutionSolved after some more work!
Created a Get Folder Metadata step
Created an Initialize Variable called FolderID, type: String, Value: DisplayName (from Get folder Metadata)
The last Copy file:
Current Site Address: https://contoso.com/Site
File to copy: Identifier (from Get Item)
Destination Site Address: https://contoso.com/Site
Destination Folder: /Drafts/FolderID (variable)
Horray!