“Any tips on how to select a specific folder in a shared mailbox with the ‘Get emails (V3)’ Power Automate action? I see only folders from my mailbox.”
Most of the email operations in Power Automate can already work with folders in shared mailboxes. If you ‘move email’ or trigger flow ‘when new email arrives’, you can select a specific folder from the mailbox. But ‘Get emails (V3)’ doesn’t offer you the folders. It’ll show your personal folders even if you enter the shared mailbox address into the ‘Original Mailbox Address’ field.
How can you select a folder in the shared mailbox when it’s not displayed?
Use the folderPath
If you select any of the available folders and then ‘Peek code’, you’ll see that the ‘Folder’ is represented by ‘folderPath’. Therefore, if you knew the ‘folderPath’, you could ignore the folder selection and enter the ‘folderPath’ directly.
Get the folderPath
To get the ‘folderPath’, you can use any of the existing actions that already works correctly, e.g. ‘Move email’. Add the ‘Move email’ action to your flow, enter the shared mailbox, and select the desired folder.
Again, use the ‘Peek code’ feature under the 3 dots to see the ‘folderPath’. That’s the ‘Folder’ you want to use in the ‘Get emails’ action. Copy the ‘folderPath’ value from the action and store it into a ‘Compose’ action.
It might look as below.
Id::AAMkADU5MjZixxxxmNjLTA0YTQxMzBiMTg0MwAuAAAAxxxxx7aAQCPhb9FaLihQxxxxA0l01MAAA=
Get emails from the folder
Once you have the ‘folderPath’, you can use it as the ‘Folder’ in the ‘Get emails’ action. Just don’t forget to enter also the ‘Original Mailbox Address’ of the shared mailbox.
Summary
It seems that the folder selection in ‘Get emails’ was somehow forgotten when the Power Automate team added support for shared mailbox. But it doesn’t have to be a blocker for you, like in many situations before (e.g with missing dynamic content), there’s a workaround.
If you know where to look, and what to look for, you don’t need the folder selection button. The ‘Peek code’ feature will tell you what the action expects, and that allows you to provide the right input. In this situation it’s the ‘folderPath’, the same string as e.g. in the ‘Move file’ action.
In the end that’s exactly what the folder button does, you select a folder and the action will turn it into a ‘folderPath’.
Thanks for sharing this amazing article. Is it possible to read a certain user email ID and fetch all the unread emails of that user?
Looking forward to your response.
Thank you!
Hello Julien,
you can’t read emails of other users, Power Automate will allow you to access only the data you could access without it. If you don’t have access to the other user’s mailbox you can’t access his emails.
Hello,
Is there another way to get the folderpath besides using sneak peek on V2?
Hello John,
I didn’t search for another way once I found this solution, therefore, I can’t answer 100% yes or no.
Hi,
amazing article, thanks! Is there a way to then directly get specific email ID?
Hello Ondrej,
the email IDs will be provided among the dynamic content outputs from this action. But to get specific email ID you’ll probably have to use the $search query parameter (https://docs.microsoft.com/en-us/graph/search-query-parameter#using-search-on-message-collections) or the ‘Subject Filter’ to find that specific email.
Is there a way to obtain an originator’s email address if the email is forwarded to you from a group email address?
Hello Esther,
you could probably extract it somehow from the email content, but I never did it before and I’m not sure how reliable it would be.
How do you find the code for the folder path for the Shared Mailbox email?
Hello Angie,
I’m not sure what’s the question, the article describes how to get the folder path for a folder in a shared mailbox.
the other way around -> if you keep shared mailbox email id in ‘original mailbox address’ and then click on folder field, you will be able to select folders from shared mailbox. so in that case folder path is not required at all
Thank you very much!!! Very usefull 🙂
Is there a way to get a count of emails in each folder in a mailbox?
dude thank you. You fixed what Microsoft couldnt.
Get Emails V3 returns the same JSON for Message ID item()?[‘id’]
and for Attachments Attachment ID item()?[‘id’].
How do you get the correct JSON for Message ID from Get Emails V3?