diff --git a/samples/convert-sharepoint-library-doc-file-to-pdf/README.md b/samples/convert-sharepoint-library-doc-file-to-pdf/README.md new file mode 100644 index 00000000..e66943a0 --- /dev/null +++ b/samples/convert-sharepoint-library-doc-file-to-pdf/README.md @@ -0,0 +1,72 @@ +# Convert SharePoint Document File to PDF + +## Summary + +This sample demonstrates how to convert document file to pdf. + +![picture of the flow](assets/flow.png) + +## Applies to + +![Power Apps](https://img.shields.io/badge/Power%20Apps-No-red "No") +![Power Automate](https://img.shields.io/badge/Power%20Automate-Yes-green "Yes") +![Power BI](https://img.shields.io/badge/Power%20BI-No-red "No") +![Power Pages](https://img.shields.io/badge/Power%20Pages-No-red "No") +![Power Virtual Agents](https://img.shields.io/badge/Power%20Virtual%20Agents-No-red "No") +![Dataverse](https://img.shields.io/badge/Dataverse-No-red "No") +![AI Builder](https://img.shields.io/badge/AI%20Builder-No-red "No") +![Custom Connectors](https://img.shields.io/badge/Custom%20Connectors-No-red "No") +![Power Fx](https://img.shields.io/badge/Power%20Fx-No-red "No") + +## Compatibility + +![Premium License](https://img.shields.io/badge/Premium%20License-Not%20Required-red.svg "Premium license not required") +![Experimental Features](https://img.shields.io/badge/Experimental%20Features-No-red.svg "Does not rely on experimental features") + +## Contributors +* [Chandani Prajapati](https://github.com/chandaniprajapati) + +## Version history + +Version|Date|Comments +-------|----|-------- +1.0|Sep 09, 2022|Initial release +2.0|October 07, 2025|Migration from powerapps-samples repository with solution repacking by [Jan Chlebek](https://github.com/jan-chlebek) + +## Minimal Path to Awesome +* [Download](./solution/convert-sharepoint-library-doc-file-to-pdf.zip) the `.zip` from the `solution` folder +* Within **Power Automate**, import the solution `.zip` file using **Solutions** > **Import Solution** and select the `.zip` file you just packed. + +## Features + +This sample demonstrates the following concepts: + +* Get file content when a file is created to document library +* Create an actual file to Onedrive +* Convert a file to PDF +* Create a PDF file to Onedrive +* Create a newly generated PDF file to document library +* Delete actual and a PDF file from Onedrive + + + +## 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=convert-sharepoint-library-doc-file-to-pdf&authors=@chandaniprajapati&title=convert-sharepoint-library-doc-file-to-pdf%20-%20). + +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=convert-sharepoint-library-doc-file-to-pdf&authors=@chandaniprajapati&title=convert-sharepoint-library-doc-file-to-pdf%20-%20). + +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=convert-sharepoint-library-doc-file-to-pdf&authors=@chandaniprajapati&title=convert-sharepoint-library-doc-file-to-pdf%20-%20). + +## For more information + +- [Create your first flow](https://docs.microsoft.com/en-us/power-automate/getting-started#create-your-first-flow) +- [Microsoft Power Automate documentation](https://docs.microsoft.com/en-us/power-automate/) + +## 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.** + + \ No newline at end of file diff --git a/samples/convert-sharepoint-library-doc-file-to-pdf/assets/flow.png b/samples/convert-sharepoint-library-doc-file-to-pdf/assets/flow.png new file mode 100644 index 00000000..352345dc Binary files /dev/null and b/samples/convert-sharepoint-library-doc-file-to-pdf/assets/flow.png differ diff --git a/samples/convert-sharepoint-library-doc-file-to-pdf/assets/sample.json b/samples/convert-sharepoint-library-doc-file-to-pdf/assets/sample.json new file mode 100644 index 00000000..2a3372ca --- /dev/null +++ b/samples/convert-sharepoint-library-doc-file-to-pdf/assets/sample.json @@ -0,0 +1,70 @@ +[ + { + "name": "pnp-powerplatform-samples-convert-sharepoint-library-doc-file-to-pdf", + "source": "pnp", + "title": "Convert sharepoint library document file to pdf", + "shortDescription": "his sample shows how to convert a doc file to a pdf in the document library.", + "url": "https://github.com/pnp/powerplatform-samples/tree/main/samples/convert-sharepoint-library-doc-file-to-pdf", + "downloadUrl": "https://pnp.github.io/download-partial/?url=https://github.com/pnp/powerplatform-samples/tree/main/samples/convert-sharepoint-library-doc-file-to-pdf", + "longDescription": [ + "This sample shows how to convert a doc file to a pdf in the document library." + ], + "creationDateTime": "2022-09-20", + "updateDateTime": "2025-10-07", + "products": [ + "Power Automate", + "PowerPlatform-samples" + ], + "tags": [ + "SHAREPOINT", "PERMISSIONS" + ], + "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/convert-sharepoint-library-doc-file-to-pdf/assets/flow.png?raw=true", + "alt": "Preview PNG" + } + ], + "authors": [ + { + "gitHubAccount": "chandaniprajapati", + "name": "Chandani Prajapati", + "pictureUrl": "https://avatars.githubusercontent.com/u/52065929?v=4" + } + ], + "references": [ + { + "name": "Create your first flow", + "description": "Anyone from a basic business user to an IT professional can create automated processes using Power Automate's no-code/low-code platform.", + "url": "https://docs.microsoft.com/en-us/power-automate/getting-started#create-your-first-flow" + }, + { + "name": "Microsoft Power Automate documentation", + "description": "Power Automate is a service that helps you create automated workflows between your favorite apps and services to synchronize files, get notifications, collect data, and more.", + "url": "https://docs.microsoft.com/en-us/power-automate/" + } + ] + } +] diff --git a/samples/convert-sharepoint-library-doc-file-to-pdf/solution/convert-sharepoint-library-doc-file-to-pdf.zip b/samples/convert-sharepoint-library-doc-file-to-pdf/solution/convert-sharepoint-library-doc-file-to-pdf.zip new file mode 100644 index 00000000..f511f3cd Binary files /dev/null and b/samples/convert-sharepoint-library-doc-file-to-pdf/solution/convert-sharepoint-library-doc-file-to-pdf.zip differ diff --git a/samples/convert-sharepoint-library-doc-file-to-pdf/sourcecode/Other/Customizations.xml b/samples/convert-sharepoint-library-doc-file-to-pdf/sourcecode/Other/Customizations.xml new file mode 100644 index 00000000..72a8a64f --- /dev/null +++ b/samples/convert-sharepoint-library-doc-file-to-pdf/sourcecode/Other/Customizations.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + OneDrive for Business convertsharepointlibrarydocfiletopdf-e43de + /providers/Microsoft.PowerApps/apis/shared_onedriveforbusiness + 1 + 0 + 0 + 1 + + + SharePoint convertsharepointlibrarydocfiletopdf-b7de6 + /providers/Microsoft.PowerApps/apis/shared_sharepointonline + 1 + 0 + 0 + 1 + + + + 1033 + + \ No newline at end of file diff --git a/samples/convert-sharepoint-library-doc-file-to-pdf/sourcecode/Other/Solution.xml b/samples/convert-sharepoint-library-doc-file-to-pdf/sourcecode/Other/Solution.xml new file mode 100644 index 00000000..0f7b9562 --- /dev/null +++ b/samples/convert-sharepoint-library-doc-file-to-pdf/sourcecode/Other/Solution.xml @@ -0,0 +1,89 @@ + + + + convertsharepointlibrarydocfiletopdf + + + + + + + 1.0.0.0 + 0 + + Microsoft_365_and_Power_Platform_Community + + + + + + + + https://pnp.github.io/ + pnp + 89378 + +
+ 1 + 1 + + + + + + + + + + + + + + + + 1 + + + + + + + + +
+
+ 2 + 1 + + + + + + + + + + + + + + + + 1 + + + + + + + + +
+
+
+ + + + +
+
\ No newline at end of file diff --git a/samples/convert-sharepoint-library-doc-file-to-pdf/sourcecode/Workflows/Convertdoctopdf-9D4854E3-BBA3-F011-BBD3-6045BD08B2CE.json b/samples/convert-sharepoint-library-doc-file-to-pdf/sourcecode/Workflows/Convertdoctopdf-9D4854E3-BBA3-F011-BBD3-6045BD08B2CE.json new file mode 100644 index 00000000..0828a686 --- /dev/null +++ b/samples/convert-sharepoint-library-doc-file-to-pdf/sourcecode/Workflows/Convertdoctopdf-9D4854E3-BBA3-F011-BBD3-6045BD08B2CE.json @@ -0,0 +1,242 @@ +{ + "properties": { + "connectionReferences": { + "shared_sharepointonline_1": { + "runtimeSource": "embedded", + "connection": { + "connectionReferenceLogicalName": "pnp_sharedsharepointonline_b7de6" + }, + "api": { + "name": "shared_sharepointonline" + } + }, + "shared_onedriveforbusiness_1": { + "runtimeSource": "embedded", + "connection": { + "connectionReferenceLogicalName": "pnp_sharedonedriveforbusiness_e43de" + }, + "api": { + "name": "shared_onedriveforbusiness" + } + } + }, + "definition": { + "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "$connections": { + "defaultValue": {}, + "type": "Object" + }, + "$authentication": { + "defaultValue": {}, + "type": "SecureObject" + } + }, + "triggers": { + "When_a_file_is_created_(properties_only)": { + "recurrence": { + "frequency": "Minute", + "interval": 1 + }, + "splitOn": "@triggerOutputs()?['body/value']", + "metadata": { + "operationMetadataId": "3853a390-eb11-4526-90a5-bbc3156af123" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline", + "connectionName": "shared_sharepointonline_1", + "operationId": "GetOnNewFileItems" + }, + "parameters": { + "dataset": "https://chlebekdev.sharepoint.com/sites/chlebekdev", + "table": "3dce7221-cadb-4703-8995-47cd7e0ac2bb" + }, + "authentication": "@parameters('$authentication')" + } + } + }, + "actions": { + "Get_file_content": { + "runAfter": {}, + "metadata": { + "operationMetadataId": "82129079-702f-46e0-a81e-06015d16fc6d" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline", + "connectionName": "shared_sharepointonline_1", + "operationId": "GetFileContent" + }, + "parameters": { + "dataset": "https://chlebekdev.sharepoint.com/sites/chlebekdev", + "id": "@triggerOutputs()?['body/{Identifier}']", + "inferContentType": true + }, + "authentication": "@parameters('$authentication')" + } + }, + "Create_Actual_File_to_OneDrive": { + "runAfter": { + "Get_file_content": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "98b8b30f-e65c-4ad0-9491-c8897493e03e" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_onedriveforbusiness", + "connectionName": "shared_onedriveforbusiness_1", + "operationId": "CreateFile" + }, + "parameters": { + "folderPath": "/PnP", + "name": "@triggerOutputs()?['body/{FilenameWithExtension}']", + "body": "@body('Get_file_content')" + }, + "authentication": "@parameters('$authentication')" + }, + "runtimeConfiguration": { + "contentTransfer": { + "transferMode": "Chunked" + } + } + }, + "Convert_file_to_PDF": { + "runAfter": { + "Create_Actual_File_to_OneDrive": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "77403e88-13f8-493a-b143-5817f1c1ab04" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_onedriveforbusiness", + "connectionName": "shared_onedriveforbusiness_1", + "operationId": "ConvertFile" + }, + "parameters": { + "id": "@outputs('Create_Actual_File_to_OneDrive')?['body/Id']", + "type": "PDF" + }, + "authentication": "@parameters('$authentication')" + } + }, + "Create_PDF_File_to_OneDrive": { + "runAfter": { + "Convert_file_to_PDF": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "449fedde-a2c7-4e56-830c-8170178d0d1e" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_onedriveforbusiness", + "connectionName": "shared_onedriveforbusiness_1", + "operationId": "CreateFile" + }, + "parameters": { + "folderPath": "/", + "name": "@outputs('Convert_file_to_PDF')?['headers/x-ms-file-name']", + "body": "@body('Convert_file_to_PDF')" + }, + "authentication": "@parameters('$authentication')" + }, + "runtimeConfiguration": { + "contentTransfer": { + "transferMode": "Chunked" + } + } + }, + "Add_PDF_File_to_Document_Library": { + "runAfter": { + "Create_PDF_File_to_OneDrive": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "eb3bbaad-5f0a-447e-8711-dbec60d35256" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline", + "connectionName": "shared_sharepointonline_1", + "operationId": "CreateFile" + }, + "parameters": { + "dataset": "https://chlebekdev.sharepoint.com/sites/chlebekdev", + "folderPath": "/Shared Documents", + "name": "@outputs('Convert_file_to_PDF')?['headers/x-ms-file-name']", + "body": "@body('Convert_file_to_PDF')" + }, + "authentication": "@parameters('$authentication')" + }, + "runtimeConfiguration": { + "contentTransfer": { + "transferMode": "Chunked" + } + } + }, + "Delete_Actual_File_From_OneDrive": { + "runAfter": { + "Add_PDF_File_to_Document_Library": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "11159aac-7a39-483d-a852-7d9e20cce290" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_onedriveforbusiness", + "connectionName": "shared_onedriveforbusiness_1", + "operationId": "DeleteFile" + }, + "parameters": { + "id": "@outputs('Create_Actual_File_to_OneDrive')?['body/Id']" + }, + "authentication": "@parameters('$authentication')" + } + }, + "Delete_PDF_File_From_OneDrive": { + "runAfter": { + "Delete_Actual_File_From_OneDrive": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "cc30805a-f2a8-409e-acdd-d9c689ea022a" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "apiId": "/providers/Microsoft.PowerApps/apis/shared_onedriveforbusiness", + "connectionName": "shared_onedriveforbusiness_1", + "operationId": "DeleteFile" + }, + "parameters": { + "id": "@outputs('Create_PDF_File_to_OneDrive')?['body/Id']" + }, + "authentication": "@parameters('$authentication')" + } + } + } + }, + "templateName": null + }, + "schemaVersion": "1.0.0.0" +} \ No newline at end of file diff --git a/samples/convert-sharepoint-library-doc-file-to-pdf/sourcecode/Workflows/Convertdoctopdf-9D4854E3-BBA3-F011-BBD3-6045BD08B2CE.json.data.xml b/samples/convert-sharepoint-library-doc-file-to-pdf/sourcecode/Workflows/Convertdoctopdf-9D4854E3-BBA3-F011-BBD3-6045BD08B2CE.json.data.xml new file mode 100644 index 00000000..efd84755 --- /dev/null +++ b/samples/convert-sharepoint-library-doc-file-to-pdf/sourcecode/Workflows/Convertdoctopdf-9D4854E3-BBA3-F011-BBD3-6045BD08B2CE.json.data.xml @@ -0,0 +1,27 @@ + + + /Workflows/Convertdoctopdf-9D4854E3-BBA3-F011-BBD3-6045BD08B2CE.json + 1 + 0 + 5 + 0 + 4 + 0 + 0 + 0 + 0 + 0 + 1 + 2 + 1 + 1 + 1.0.0.0 + 1 + 0 + 1 + 0 + none + + + + \ No newline at end of file