cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
BA_Pete
Frequent Visitor

New message in Teams channel, rename attachment, save attachment to Sharepoint

Hi all,

 

I'm super new to Power Automate so please be gentle 🙂

 

My scenario:

I have a number of systems that email data exports into MS Teams channels. Each export is designed to be a complete new dataset, therefore should overwrite the previous file of the same name. This allows my Power BI dataflows to refresh based on the new data contained in the new dataset of the same name.

 

The first issue is that Teams is adding a long string of numbers to the end of the attachment filenames so there is no auto-overwrite.

 

The second issue is that the [Created date] and [Modified date] records appear to be getting corrupted (Power BI apparently can't parse the date format), so I can't identify the latest file version if I just bring the whole channel folder into Power BI.

 

Therefore, what I need please:

A noob-friendly guide to set up the following flow in Power Automate:

1) New message received in Teams channel.

2) Check if attachment file name includes certain words to identify whether it's an attachment that I want to pick up.

3) Rename the attachment to remove the long string of numbers from the end of the filename.

4) Save to a given SharePoint folder, overwriting the file of the same name already in there.

For bonus points: 5) Refresh all Power BI dataflows/datasets that use this file as a source (if this can be done without a Premium Capacity Plan, as I don't have that)

 

Many thanks.

 

Pete

1 ACCEPTED SOLUTION

Accepted Solutions
BA_Pete
Frequent Visitor

I've solved this myself.

 

As emails received in a Teams channel are saved to SharePoint on receipt anyway, I didn't need to use the Teams connector, just the SharePoint ones.

 

Here's how my final flow looks that works as required:

succesfulFlow.PNG

 

I also had to turn "Allow chunking" OFF in the Create File settings to get the file to overwrite the previous in line with recent shadow-changes.

 

Worth noting that this method receives .xls files, but creates .xlsx files on SharePoint. These files will appear corrupted if you try and open them in Excel, but Power BI can import them fine without the need of an OLEDB Provider.

 

Pete

View solution in original post

2 REPLIES 2
BA_Pete
Frequent Visitor

Ok. So I've clearly asked the wrong question and/or in the wrong way, apologies.

 

By way of background, here is what I have so far:

AutomateWIPaddr1.PNG

 

The Data Files channel within the BP&A Data Team receives emails with the subject "WIP Addresses", and always has an attachment "WIPaddr.xls".

 

When running a test, I get the following error at the condition stage:

Action 'Condition' failed

Unable to process template language expressions for action 'Condition' at line '1' and column '17553': 'The template language function 'contains' expects its first argument 'collection' to be a dictionary (object), an array or a string. The provided value is of type 'Null'.'.

So clearly I have set up the condition stage using the incorrect argument(s), but I don't really know where to start in finding the correct configuration.

 

I would also like to clarify that, regardless of how my original post was worded (poorly), I'm not asking someone just to do all this for me. I need to learn this for myself so looking for any pointers/guidance of where to find good, clear, instructions on how to achieve my aim. I figured this would be the place to come having spent two or three days googling it and getting progressively more confused.

 

Pete

 

BA_Pete
Frequent Visitor

I've solved this myself.

 

As emails received in a Teams channel are saved to SharePoint on receipt anyway, I didn't need to use the Teams connector, just the SharePoint ones.

 

Here's how my final flow looks that works as required:

succesfulFlow.PNG

 

I also had to turn "Allow chunking" OFF in the Create File settings to get the file to overwrite the previous in line with recent shadow-changes.

 

Worth noting that this method receives .xls files, but creates .xlsx files on SharePoint. These files will appear corrupted if you try and open them in Excel, but Power BI can import them fine without the need of an OLEDB Provider.

 

Pete

View solution in original post

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

MSFTBizAppsLaunchEvent

Experience what’s next for Power Virtual Agents

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Users online (55,275)