Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions samples/mail-archive-pdf/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Archive email and attachments in a pdf file

## Summary

This sample showcases how to merge an email and its attachments into a single PDF file using standard Power Automate actions. The generated archive PDF is stored in a designated OneDrive folder. Additionally, the flow highlights how to leverage the conversion capabilities of the OneDrive connector to handle Office documents and PDF files as part of the archival process.

**Features:**

* Archive email and attachments (office docs, pdf etc.) into a pdf file
* Export email as html file
* Method to combine email and attachments
* Expression

![Flow overview](./assets/flow-overview.png "Flow overview")

## Applies to

![Power Automate](https://img.shields.io/badge/Power%20Automate-Yes-green "Yes")

## Compatibility

![Premium License](https://img.shields.io/badge/Premium%20License-Not%20Required-green.svg "Does not use Premium license")
![On-Premises Connectors](https://img.shields.io/badge/On--Premises%20Connectors-No-green.svg "Does not use on-premise connectors")
![Custom Connectors](https://img.shields.io/badge/Custom%20Connectors-Not%20Required-green.svg "Does not use custom connectors")

## Contributors

* [Manish Solanki](https://github.com/Solanki-Manish)

## Version history

Version|Date|Comments
-------|----|--------
1.0|Jan 24, 2026|Initial release

## Prerequisites

### Connection References
The solution includes two connection references.
* Office 365 Outlook Connection
* OneDrive For Business Connection

### Environment Variable
When importing the solution, there are a variety of environment variables that need to be completed.

Variable|Type|Details
-------|----|--------
Incoming Email Subject | Text | Defines the subject filter used to trigger the workflow from an email
Output Archive Folder | Text | Specifies the OneDrive folder path where the archived PDF will be saved

## Minimal Path to Awesome

### Import Solution

* [Download](./solution/mail-archive-pdf.zip) the `.zip` from the `solution` folder
* [Import](https://learn.microsoft.com/en-us/power-apps/maker/data-platform/import-update-export-solutions) the `.zip` file using **Solutions** > **Import Solution**.

### Using the source code

You can also use the [Power Apps CLI](https://docs.microsoft.com/powerapps/developer/data-platform/powerapps-cli) to pack the source code by following these steps:

* Clone the repository to a local drive
* Pack the source files back into a solution `.zip` file:

```bash
pac solution pack --zipfile pathtodestinationfile --folder pathtosourcefolder --processCanvasApps
```

Making sure to replace `pathtosourcefolder` to point to the path to this sample's `sourcecode` folder, and `pathtodestinationfile` to point to the path of this solution's `.zip` file (located under the `solution` folder)
* Within **Power Apps Studio**, import the solution `.zip` file using **Solutions** > **Import Solution** and select the `.zip` file you just packed.

## Features

This sample illustrates the following concepts:

* Reusablility
* Use of XML & XPATH for complex automation scenerios
* Use of complex nested expressions
* Concept of parent-child flow

## Help

We do not support samples, but this community is always willing to help, and we want to improve these samples. We use GitHub to track issues, which makes it easy for community members to volunteer their time and help resolve issues.

If you encounter any issues while using this sample, you can [create a new issue](https://github.com/pnp/powerapps-samples/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Abug-suspected&template=bug-report.yml&sample=mail-archive-pdf&authors=@Solanki-Manish&title=mail-archive-pdf).

For questions regarding this sample, [create a new question](https://github.com/pnp/powerapps-samples/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Abug-suspected&template=question.yml&sample=mail-archive-pdf&authors=@Solanki-Manish&title=mail-archive-pdf).

Finally, if you have an idea for improvement, [make a suggestion](https://github.com/pnp/powerapps-samples/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Abug-suspected&template=suggestion.yml&sample=mail-archive-pdfy&authors=@Solanki-Manish&title=mail-archive-pdf).

## Disclaimer

**THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.**

<img src="https://m365-visitor-stats.azurewebsites.net/powerplatform-samples/samples/mail-archive-pdf" aria-hidden="true" />
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
71 changes: 71 additions & 0 deletions samples/mail-archive-pdf/assets/sample.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
[
{
"name": "pnp-powerplatform-samples-mail-archive-pdf",
"source": "pnp",
"title": "Archive email and attachments in pdf",
"shortDescription": "Flow that archives an email and its attachments in a single pdf file",
"url": "https://github.com/pnp/powerplatform-samples/tree/main/samples/mail-archive-pdf",
"downloadUrl": "https://pnp.github.io/download-partial/?url=https://github.com/pnp/powerplatform-samples/tree/main/samples/mail-archive-pdf",
"longDescription": [
"This sample demonstrates how to merge an email and its attachments into a single PDF file using standard actions. The resulting archive PDF will be stored in the OneDrive folder."
],
"creationDateTime": "2026-01-24",
"updateDateTime": "2026-01-24",
"products": [
"Power Automate",
"Power Platform"
],
"tags": [
"pdf",
"archive",
"flow",
"outlook",
"onedrive",
"expression",
"html"
],
"categories": [
"CLOUD-FLOW"
],
"metadata": [
{
"key": "POWERAPPS-EXPERIMENTAL",
"value": "No"
},
{
"key": "POWERAPPS-PREMIUM",
"value": "No"
},
{
"key": "POWERAPPS-ONPREM",
"value": "No"
},
{
"key": "POWERAPPS-CUSTOMCONNECTOR",
"value": "No"
}
],
"thumbnails": [
{
"type": "image",
"order": 100,
"url": "https://github.com/pnp/powerplatform-samples/raw/main/samples/mail-archive-pdf/assets/flow-overview.png",
"alt": "Flow overview"
}
],
"authors": [
{
"gitHubAccount": "https://github.com/Solanki-Manish",
"pictureUrl": "https://github.com/Solanki-Manish.png",
"name": "Manish Solanki"
}
],
"references": [
{
"name": "Microsoft Power Platform documentation",
"description": "Discover how to make the most of Microsoft Power Platform products with online training courses, docs, and videos covering product capabilities and how-to guides.",
"url": "https://learn.microsoft.com/power-platform/"
}
]
}
]
Binary file not shown.
36 changes: 36 additions & 0 deletions samples/mail-archive-pdf/sourcecode/Other/Customizations.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<ImportExportXml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" OrganizationVersion="9.2.26012.140" OrganizationSchemaType="Standard" CRMServerServiceabilityVersion="9.2.26012.00140">
<Entities />
<Roles />
<Workflows />
<FieldSecurityProfiles />
<Templates />
<EntityMaps />
<EntityRelationships />
<OrganizationSettings />
<optionsets />
<CustomControls />
<EntityDataProviders />
<connectionreferences>
<connectionreference connectionreferencelogicalname="new_sharedonedriveforbusiness_1a9c7">
<connectionreferencedisplayname>OneDrive for Business</connectionreferencedisplayname>
<connectorid>/providers/Microsoft.PowerApps/apis/shared_onedriveforbusiness</connectorid>
<iscustomizable>1</iscustomizable>
<promptingbehavior>0</promptingbehavior>
<statecode>0</statecode>
<statuscode>1</statuscode>
</connectionreference>
<connectionreference connectionreferencelogicalname="pnp_sharedoffice365_56894">
<connectionreferencedisplayname>Office 365 Outlook Mail</connectionreferencedisplayname>
<connectorid>/providers/Microsoft.PowerApps/apis/shared_office365</connectorid>
<description>Office 365 outlook connection</description>
<iscustomizable>1</iscustomizable>
<promptingbehavior>0</promptingbehavior>
<statecode>0</statecode>
<statuscode>1</statuscode>
</connectionreference>
</connectionreferences>
<Languages>
<Language>1033</Language>
</Languages>
</ImportExportXml>
85 changes: 85 additions & 0 deletions samples/mail-archive-pdf/sourcecode/Other/Solution.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<ImportExportXml version="9.2.26012.140" SolutionPackageVersion="9.2" languagecode="1033" generatedBy="CrmLive" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" OrganizationVersion="9.2.26012.140" OrganizationSchemaType="Standard" CRMServerServiceabilityVersion="9.2.26012.00140">
<SolutionManifest>
<UniqueName>MailArchivePDF</UniqueName>
<LocalizedNames>
<LocalizedName description="Mail Archive PDF" languagecode="1033" />
</LocalizedNames>
<Descriptions />
<Version>1.0.0.0</Version>
<Managed>2</Managed>
<Publisher>
<UniqueName>pnp</UniqueName>
<LocalizedNames>
<LocalizedName description="pnp" languagecode="1033" />
</LocalizedNames>
<Descriptions />
<EMailAddress xsi:nil="true"></EMailAddress>
<SupportingWebsiteUrl xsi:nil="true"></SupportingWebsiteUrl>
<CustomizationPrefix>pnp</CustomizationPrefix>
<CustomizationOptionValuePrefix>89378</CustomizationOptionValuePrefix>
<Addresses>
<Address>
<AddressNumber>1</AddressNumber>
<AddressTypeCode>1</AddressTypeCode>
<City xsi:nil="true"></City>
<County xsi:nil="true"></County>
<Country xsi:nil="true"></Country>
<Fax xsi:nil="true"></Fax>
<FreightTermsCode xsi:nil="true"></FreightTermsCode>
<ImportSequenceNumber xsi:nil="true"></ImportSequenceNumber>
<Latitude xsi:nil="true"></Latitude>
<Line1 xsi:nil="true"></Line1>
<Line2 xsi:nil="true"></Line2>
<Line3 xsi:nil="true"></Line3>
<Longitude xsi:nil="true"></Longitude>
<Name xsi:nil="true"></Name>
<PostalCode xsi:nil="true"></PostalCode>
<PostOfficeBox xsi:nil="true"></PostOfficeBox>
<PrimaryContactName xsi:nil="true"></PrimaryContactName>
<ShippingMethodCode>1</ShippingMethodCode>
<StateOrProvince xsi:nil="true"></StateOrProvince>
<Telephone1 xsi:nil="true"></Telephone1>
<Telephone2 xsi:nil="true"></Telephone2>
<Telephone3 xsi:nil="true"></Telephone3>
<TimeZoneRuleVersionNumber xsi:nil="true"></TimeZoneRuleVersionNumber>
<UPSZone xsi:nil="true"></UPSZone>
<UTCOffset xsi:nil="true"></UTCOffset>
<UTCConversionTimeZoneCode xsi:nil="true"></UTCConversionTimeZoneCode>
</Address>
<Address>
<AddressNumber>2</AddressNumber>
<AddressTypeCode>1</AddressTypeCode>
<City xsi:nil="true"></City>
<County xsi:nil="true"></County>
<Country xsi:nil="true"></Country>
<Fax xsi:nil="true"></Fax>
<FreightTermsCode xsi:nil="true"></FreightTermsCode>
<ImportSequenceNumber xsi:nil="true"></ImportSequenceNumber>
<Latitude xsi:nil="true"></Latitude>
<Line1 xsi:nil="true"></Line1>
<Line2 xsi:nil="true"></Line2>
<Line3 xsi:nil="true"></Line3>
<Longitude xsi:nil="true"></Longitude>
<Name xsi:nil="true"></Name>
<PostalCode xsi:nil="true"></PostalCode>
<PostOfficeBox xsi:nil="true"></PostOfficeBox>
<PrimaryContactName xsi:nil="true"></PrimaryContactName>
<ShippingMethodCode>1</ShippingMethodCode>
<StateOrProvince xsi:nil="true"></StateOrProvince>
<Telephone1 xsi:nil="true"></Telephone1>
<Telephone2 xsi:nil="true"></Telephone2>
<Telephone3 xsi:nil="true"></Telephone3>
<TimeZoneRuleVersionNumber xsi:nil="true"></TimeZoneRuleVersionNumber>
<UPSZone xsi:nil="true"></UPSZone>
<UTCOffset xsi:nil="true"></UTCOffset>
<UTCConversionTimeZoneCode xsi:nil="true"></UTCConversionTimeZoneCode>
</Address>
</Addresses>
</Publisher>
<RootComponents>
<RootComponent type="29" id="{d9dd717e-72bb-b645-7c1f-7bbd486627d4}" behavior="0" />
</RootComponents>
<MissingDependencies />
</SolutionManifest>
</ImportExportXml>
Loading