I am trying to retrieve the Folder ID based on the path of the folder using Microsoft Power Automate. I don’t see a Power Automate Action that accomplishes this. I’m not a developer so I am looking for a simple way to retrieve this information using the Box API. Any ideas?
Hi @scamero2 , welcome to the forum!
Can you elaborate a bit more?
Where are you getting the path, and how does that path relate to the Box structure?
Can you send some examples?
I am trying to create an automated workflow in Microsoft Power Automate. In Power Automate I have a flow that includes a Create file action to create a file in Box. For example, it might create the following file:
/Clients/ABC Client/Client Meetings/Previous Test Case/one.txt
The path is dynamic based on variables defined in the flow. Once the file is created, I need to retrieve the Folder ID for /Clients/ABC Client/Client Meetings/Previous Test Case to use later in my flow.
There isn’t an action in Power Automate to retrieve the folder ID. On a Power Automate forum someone recommended using the Box API and an HTTP Get action to retrieve the folder ID. I am uncertain how to do that and deal with the authentication. I was hoping for a simpler method.
Hi @scamero2 ,
My hope is that when you create the file in Box you should get a file_id
back. This would make things much easier, and can be accomplished with a single api call.
Assuming that `file_id= 1282567002306’
Then an API Get to the file end point:
curl --location 'https://api.box.com/2.0/files/1282567002306?fields=id%2Ctype%2Cname%2Cparent' \
--header 'Authorization: Bearer aNWi...8DF' \
Returns:
{
"type": "file",
"id": "1282567002306",
"etag": "0",
"name": "Box-Dive-Waiver.pdf",
"parent": {
"type": "folder",
"id": "222041173483",
"sequence_id": "0",
"etag": "0",
"name": "Barbosa"
}
}
What is puzzling to me is that you need the folder_id
to create or upload the file…
Let us know if this helps.
Cheers
I can confirm that when using the following python snippet, the return contains a number of attributes identifying the new object, including the ‘id’ (or ‘object_id’):
r = boxClient.folder(boxGuestFolderId).upload(boxGuestCredentialsFilePath, boxGuestCredentialsFilename)
Here is the full list I see on the file upload/create action:
> ‘add_classification’, ‘add_comment’, ‘add_to_collection’, ‘apply_watermark’, ‘as_user’, ‘clone’, ‘collaborate’,‘collaborate_with_login’, ‘content’, ‘content_created_at’, ‘content_modified_at’, ‘copy’,‘create_shared_link’, ‘create_task’, ‘create_upload_session’, ‘created_at’, ‘created_by’, ‘delete’,‘delete_version’, ‘delete_watermark’, ‘description’, ‘download_to’, ‘etag’, ‘file_version’, ‘get’,‘get_all_metadata’, ‘get_chunked_uploader’, ‘get_classification’, ‘get_collaborations’, ‘get_comments’,‘get_download_url’, ‘get_embed_url’, ‘get_previous_versions’, ‘get_representation_info’,‘get_shared_link’, ‘get_shared_link_download_url’, ‘get_tasks’, ‘get_thumbnail’,‘get_thumbnail_representation’, ‘get_type_url’, ‘get_url’, ‘get_watermark’, ‘id’, ‘item_status’,‘lock’, ‘metadata’, ‘modified_at’, ‘modified_by’, ‘move’, ‘name’, ‘object_id’, ‘object_type’,‘owned_by’, ‘parent’, ‘path_collection’, ‘preflight_check’, ‘promote_version’, ‘purged_at’,‘remove_classification’, ‘remove_from_collection’, ‘remove_shared_link’, ‘rename’,‘response_object’, ‘sequence_id’, ‘session’, ‘set_classification’, ‘set_disposition_at’, ‘sha1’,‘shared_link’, ‘size’, ‘translator’, ‘trashed_at’, ‘type’, ‘unlock’, ‘untranslated_fields’,‘update_classification’, ‘update_contents’, ‘update_contents_with_stream’, ‘update_info’, ‘validate_item_id’, ‘with_shared_link’]
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.