Imagine you're working on a project, you receive
a lot of emails about that project with important attachments that you need to save to a common
drive. You take a week off, you go on vacation, you come back, your mailbox is flooded with email.
You're digging through those emails to find those attachments. It's not a relaxing way to start
off your day. Now, what if I told you that you could set it up so these email attachments are
automatically saved to the drive the moment they enter your inbox, no matter where you are? So,
you could be sleeping and it's working for you. You don't have to hire an assistant, you
just need five minutes to set up your flow in Power Automate. Here's how it works:
you open up your browser, you go to office.com, log in with your credentials, and then you bring
up Power Automate. So, I'm going to go to more apps here and select Power Automate. I want to
create a new flow, so click on "Create". This flow is going to be an automated cloud flow. Why? Well,
because the trigger is the email, so the moment an email enters my inbox, it should be scanned.
If that email has an attachment and if it belongs to a specific project or a specific person, then I
want that email saved under drive. So, we're going to go with "Automated cloud flow." Let's give this
flow a name, I'll call it "Save Attachments." The flow's trigger is for Outlook, so let's type in
Outlook to see the options that we have. We have when a new email arrives in a shared mailbox, when
a new email arrives mentioning me or when a new email arrives, this is more generic is for Outlook
Office 365. I'm going to go with this one, select it, click on create. First thing to decide on
is the folder. So, if you have a rule that moves emails to a specific folder based on the subject
or the sender, then you can select that specific folder. In this case, I'm just going to go with
inbox. So, I'm basically going to be scanning each single email that enters the inbox. Let's go and
show advanced options and adjust more settings. So, one thing I want to do is make sure that
it's an email that has attachments. So, for only with attachments, we're going to select "Yes." You
can adjust the importance, so if you only want important emails, emails that are marked with
high importance to have the attachment saved, then you can adjust your selection here. In this
case, I don't care, so I'm going to go with any. For include attachments, I'm going to go with "Yes,"
and for subject filter, well, I want to scan for a specific subject and that subject is Project XelPlus. Because everyone working on this project knows that whenever you send attachments regarding this project, you need to have Project XelPlus as a subject. I can put in specific senders but
in this case, I'm just going to leave it empty, because it doesn't matter who it comes from right.
So you have all these different options to adjust. Once you're done, add a new step. Now, we want to
make sure that every single attachment is saved. So, what we're going to need is a control and that
control is an "Apply to Each." We want this to apply to each attachment. So, it says that we need to
select an output from the previous step. Well, the output of the previous step is the metadata
that comes from this email that's arrived. And here, we need to use dynamic content. What
we want to grab is the attachment. If I go all the way to the bottom, I can see attachments here.
Once we have the attachment, we need to save this on the drive. It depends on where you want to save
it. In this case, let's say I'm collaborating with other people and I want to save it on SharePoint.
What I need to do is to create a new file on the drive. So let's just see where we have "create
file" - that's right here. Select that. Now, we need to put in the SharePoint address. Select your
address. Next, you need to decide on the folder path. So, if you've already created a folder
that you need, you can select that. In this case, I'm going to save everything in "Reporting." Next,
I need to give each attachment a file name. Well, that's going to be dynamic content and it's just
going to be based on the name of the attachment. So, if we scroll down, we should see something
like "attachment name," which is right here. Then it's "file content" and that's the content of
the attachment. We don't have many options anyhow, so let's just select that. Okay, so, so
far so good, everything is set up. Let's save this. We're saving everything to
"Monthly Reporting." Now, it's not for any attachment that comes in, but it's only for emails
that have "Project XelPlus" as the subject. So, let's test it out. I'm going to click on "Test"
right here. We're going to test this out manually. Click on "Test." Now, I'm just going to go ahead
and send an email that has "Project XelPlus" as the subject and that email has attachments. Let's
see if the attachments get saved properly. Okay, so I sent an email that has "Project XelPlus"
as the subject. We have two separate Excel files attached to this email. Now, let's jump back to
our flow. It says that "Your flow ran successfully." We can see here that it's succeeded. So,
let's check if our files actually got saved on the drive. I'm going to bring up SharePoint,
Documents. This is the "Monthly Reporting" folder, and we have the two files that were in the
attachment automatically saved in here. If an email arrives that doesn't have "Project
XelPlus" as the title, then these attachments are not going to be saved. And notice that
it's not case-sensitive. I've typed everything in small letters and it still got picked up.
Now, you could also create subfolders depending on the sender. So, let's say, for this project,
we want to keep the files that we receive from our boss in a separate folder to everything
else. You can create subfolders here. So, let's just go ahead and create a new folder. I'll
call this one "Boss." Let's say everything else, we just want to save directly here. Boss's files
will go in the "Boss" folder. Let's go back to our flow and add a step here. Now, that action is
going to be a condition to check for a specific email. Now, it can also be a switch. So, if
you have multiple different checks, you want to check if it's from the boss or from also another
person and always save these in different folders, you can use a switch. It's similar to the SWITCH
function in Excel. In case you have multiple IF statements, you can always add multiple switches.
The switch is going to be on the "From" field. So, depending on who we receive this email from, we
are going to decide what to do now that the "From" field equals "info@xelplus.com". So,
let's assume that this is the boss. What we want to happen is to add an action. You
just have to repeat what we did before. We need an "Apply to Each", and we're going to apply to
each attachment. Let's scroll all the way down and select attachments. I'm just going
to delete that. Then let's add an action. Go with SharePoint and save the files. Basically,
we have to create a new file on SharePoint, select "Create File", and select the SharePoint
drive. You can, of course, have different locations that you want to save everything from.
So, if it's from the boss and you happen to want to save it on your OneDrive, you can. Let's select
the folder. In this case, we are going to go with the subfolder that we just created called the
"Boss Folder". The file name should be dynamic, depending on the attachment name. So, let's
see where we can find that. It's right here, "Attachment Name". "File Content" is "Attachment
Content", so the dynamic content makes it really easy to manage. Now with the switch, you
can have multiple cases. So, we could add another one and check for another email address
and decide where we want to save that file. We can add as many cases as we need. Now, in
this case, just to keep it simple, I'm going to delete the other case and just go for the default
conditions. If no case contains a matching value, what do we want? Well, we want to save everything
to that monthly reporting folder. So, I'm just going to drag and drop this inside the default.
Everything is set up. I'm just going to save this. Now, I'm going to go ahead and send a few emails
with attachments and let's see where they get saved. A few moments later, okay, so I've gone
ahead and sent a few emails. There is one email with attachments, but it doesn't have "XelPlus"
in there, so it just says "Not for a Project". This attachment shouldn't get saved. Then I have
another one. It says "For Project XelPlus", so there are two attachments here, these two PDFs.
These should be saved, but they aren't from the boss, so they should be saved just directly under
the Monthly Reporting folder. This one is from the boss, so the "Monthly Sales Reporting" should get
saved inside the "Boss" folder. Now let's go ahead and see if this works. I'm going to jump to
SharePoint. Let's refresh this, and I can see one and two. These two PDFs got saved.
The other one didn't get saved at all, and inside the "Boss" folder, I should have one,
and I do. Okay, so the flow ran successfully. Remember, you can use a condition. You can
use a switch if you have multiple cases. It makes things easier to handle. This way,
you don't have to dig through your emails to find attachments. You get them automatically saved
wherever you want. This is how you can manage your attachments with the help of Power Automate. So,
I hope you found it useful. If you enjoyed this video, do give it a thumbs up and make sure you're
subscribed so I get to see you in the next video.