Logic Apps - Move Email to Subfolder

Copper Contributor

I'm fairly new to Logic Apps and I have an app that connects to a shared Exchange Online mailbox saves the attachments and then moves the email to a subfolder. I have everything working except moving the email to a subfolder.  I generate the path based on the date and I cannot for the life of me get it to work. I don't know if my path syntax is wrong or what.

This is the subfolder structure

- Inbox
 - 2018
  - Jan
  - Feb
  - Mar
  - Etc

And I'm trying to generate the path based off the year and the month using the Expressions part of a field. I've got an expression that generates the path for me

concat('/Inbox/',formatDateTime(convertFromUtc(utcNow(),'Mountain Standard Time'),'yyyy'),'/',formatDateTime(convertFromUtc(utcNow(),'Mountain Standard Time'),'MMM'))

When the logic app runs this generates the correct path string of /Inbox/2018/Jan (I've also tried the following strings) 


 but when the Move Email action runs it always fails and gives an error that the folder does not exist.

So I either have the format wrong, I can't put the email in a subfolder or there's another way to do this.


I tried using the folder picker to pick one of the month subfolders and then peeked at the code and it uses some base64 encoded string for the path. I've pasted below what the peeked code shows

    "inputs": {
        "host": {
            "connection": {
                "name": "@parameters('$connections')['office365']['connectionId']"
        "method": "post",
        "path": "/Mail/Move/@{encodeURIComponent(triggerBody()?['Id'])}",
        "queries": {
            "folderPath": "Id::AAMkADRmOTgyMDI1LThkODYtNDMwYy1iYThiLTIzODQwN2Y1OGMzYQAuAAAAAAA6K3dJssnITb8NwkAsBOo7AQBaJ9ZTcg-MSoOEUUjjUdOAAAAD0nvYAAA="
        "authentication": "@parameters('$authentication')"
    "metadata": {

Does anyone know how I would be able to move an email to a subfolder without using the folder picker (since the subfolder will change based on the month)?


0 Replies