Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Unanswered

move email attachment to the right sharepoint folder

(0) ShareShare
ReportReport
Posted on by 13

Hello everyone. I'm really new to power automate and I want to realize a flow that works like this:

 

structogramm.png

 

So I've created this Nassi–Shneiderman diagram to show what I mean. I also started to create the flow in power automate but where I get stuck, is to get ONLY the year and ONLY the month as a number from the received email. I think I have to do something with the compose and variable steps but I really have no clue what I should enter there to achive this. I'm not new to coding and stuff but I'm a beginner and need a little bit help... 

 

Here is also my flow in power automate:

 

screen_1.png

screen_2.png

 

Many thanks to everyone 🙂

  • alexej1 Profile Picture
    13 on at
    Re: move email attachment to the right sharepoint folder

    Hi Scott

    I figured out why the condition step always shot back with "false". It's because in the output from the "list folder" step you can see that there are " before and after the number.

     "Name": "2021",
     "DisplayName": "2021",

    The output from the compose step gives only the number (2021) without the ".

    So how can I fix this?

     

    Thanks for your help.

  • alexej1 Profile Picture
    13 on at
    Re: move email attachment to the right sharepoint folder

    Hi Scott.

    Thank you very much for your helpful answer. However, there are still a few issues I would like to resolve.

    1. The condition expression result always shots back with "false" even when the folder (e.g. 2021) exists

    screenshot_1.png

    I looked at the outputs from the previous step and found the following:

    {
    "Id": "%252fFreigegebene%2bDokumente%252fASC%252fAdministratives%252fLohnabrechnungen%252f2021",
    "Name": "2021",
    "DisplayName": "2021",
    "Path": "/Freigegebene Dokumente/ASC/Administratives/Lohnabrechnungen/2021",
    "LastModified": "0001-01-01T00:00:00",
    "Size": 0,
    "IsFolder": true
    }
    ]

    as you can see the folder "2021" is listed and effectively exists in the directory.

    Here you can see the configuration of the condition step:

    condition_if_folder_exists.png

    I've tried it with the "Name" and "DisplayName" variable from the "List folder" step. The step still shots back with "false"...

     

    2. The file was named almost correctly

    screenshot_2.png

    I would like to have the file named like this:

    Example: 01_January_2021

    The reason for the "0" is that teams can't sort properly if you name your files like "1, 2, 3 ...". Here is a screenshot of what I mean. I have to name it like "01, 02, 03 ..." so that it will sort it correctly when I'm going to reach "10" and above.

    screenshot_sorting.png

    Also, it would be nice if the file contains the month as text, as shown in the example and of course equal to the associated number of the month.

     

    Thank you for your efforts to help me!

    Greetings.

  • alexej1 Profile Picture
    13 on at
    Re: move email attachment to the right sharepoint folder

    Hi Scott!

    First, I want to thank you for your response. It helped me a lot!

    But there are a couple of new problems I like to solve now. With your response I managed to create a folder with the name of the year. Also, I managed to rename the file the way I would like it, at least almost.

    Here are my "new" problems:

    1. The condition expression result always shots back with "false", even when the folder (e.g. 2021) exists

    screenshot_1.png

    I took a quick look in the outputs from the "List folder" step and as you can see the folder 2021 exists and is listed in the output:

     

    {
     "Id": "%252fFreigegebene%2bDokumente%252fASC%252fAdministratives%252fLohnabrechnungen%252f2021",
     "Name": "2021",
     "DisplayName": "2021",
     "Path": "/Freigegebene Dokumente/ASC/Administratives/Lohnabrechnungen/2021",
     "LastModified": "0001-01-01T00:00:00",
     "Size": 0,
     "IsFolder": true
     }
    ]

     

    Here is a screenshot from the configuration of the condition step. I tried it with the "Name" and "DisplayName" variable from the "List folder" step. The output variable is the year.

    condition_if_folder_exists.png

     

    2. The attachment file was named almost correctly

    screenshot_2.png

    It would be nice if the step could name the file like this:

    Example: 01_January_2021

    The reason for the "0" is that teams listing or sorts files like this:

    01, 02, 03 ...

    and when you name your files like: 1, 2, 3 ... and when you come to "10" and above it will not sorted correctly. Here is a screenshot from what I mean:

    screenshot_sorting.png

    Also I would like to add the month as text, shown in the example. Of course equal to the associated number of the month.

     

    Thank you so much!

    Greetings

  • ScottShearer Profile Picture
    25,228 Most Valuable Professional on at
    Re: move email attachment to the right sharepoint folder

    @alexej1 

    When you say you want only the year and only the month as numbers from the email, what date are you looking at? 

    If you are looking at the received date, see my example below.  My expressions can be seen in the comments.

    image.png

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1