cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
alexej1
Regular Visitor

move email attachment to the right sharepoint folder

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 🙂

4 REPLIES 4
ScottShearer
Super User III
Super User III

@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

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

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

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.

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.

Helpful resources

Announcements
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Users online (59,165)