
Announcements
Hi Experts,
I'm developing a Power App with three screens: Home, New Request, and Browse Mail. Users start on the Home screen and click the "+" icon to navigate to the New Request screen. This screen contains a vertical gallery connected to a SharePoint list where users input required information. There's also an "Add Document" icon that takes users to the Browse Mail screen.
The Browse Mail screen displays the user's inbox via a vertical gallery connected to Outlook. I've implemented a checkbox control for email selection:
Collect(SelectedEmails, ThisItem)Remove(SelectedEmails, ThisItem)Set(selectedEmailSubject, ThisItem.Subject)A "Save" icon on the Browse Mail screen navigates users back to the New Request screen, passing the selected emails:
Navigate(New_Request,ScreenTransition.Fade,{SelectedEmails: SelectedEmails})Currently, the SelectedEmails collection is passed to the New Request screen. I need to save the emails selected by the user (contained in the SelectedEmails collection) as files within a SharePoint document library called "Scheme_Approval_Flow". Could you please advise on how to achieve this?
Specifically, I need help with the code to add to the "Save" icon's OnSelect property on the New Request screen. I'm unsure how to iterate through the SelectedEmails collection and save each email as a separate file in the SharePoint library. Any guidance on this would be greatly appreciated.
Thanks in advance!
To save the selected emails as files in the SharePoint document library "Scheme_Approval_Flow," you can use Power Automate to handle the process. Here's a step-by-step guide to achieve this:
Create a Power Automate Flow:
PowerApps trigger to start the flow when the "Save" icon is clicked.SelectedEmails collection passed from Power Apps.Initialize variable:
Name: SelectedEmails
Type: Array
Value: PowerApps trigger output
2. Loop Through SelectedEmails:
Apply to each action to iterate through the SelectedEmails collection.Apply to each:
Input: SelectedEmails
3.Export Email:
Office 365 Outlook - Export Email (V2) action to export each email.Export Email (V2):
Message Id: @{items('Apply_to_each')?['Id']}
```
4.Create File in SharePoint:
SharePoint - Create File action to save the exported email in the SharePoint document library.Create File:
Site Address: Your SharePoint site address
Folder Path: /Scheme_Approval_Flow
File Name: @{items('Apply_to_each')?['Subject']}.eml
File Content: @{body('Export_Email_(V2)')}
5.Return to Power Apps:
Respond to PowerApps:
Status: Success
6. Power Apps Integration:
OnSelect property of the "Save" icon on the New Request screen to call the Power Automate flow and pass the SelectedEmails collection.OnSelect:
'YourFlowName'.Run(SelectedEmails)
```
If the response is helpful to you, a like or mark as the correct solution. thank you so much!