diff --git a/samples/create-folder-with-link-back-to-list/README.md b/samples/create-folder-with-link-back-to-list/README.md new file mode 100644 index 00000000..25650a57 --- /dev/null +++ b/samples/create-folder-with-link-back-to-list/README.md @@ -0,0 +1,91 @@ +# Create folder with link back to list + +## Summary + +This sample creates a folder in a *SharePoint* document library and then stores the link to the newly created folder inside of *Microsoft Lists* using *Power Automate*. The folder name is based on a combination of list columns and provides a better link experience compared to the default URL. + +![Flow overview](./assets/flow-overview.png) + + +Our list item looks like the image below. Clicking on the *FolderLocation* link will take you to the folder location. + +![List item](./assets/list-item.png) + +![Folder](./assets/folder.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 +* [Norm Young](https://github.com/nyoung30) ([@stormin_30](https://twitter.com/stormin_30)) + + +## Version history + +Version|Date|Comments +-------|----|-------- +1.0|October 10, 2022|Initial release +2.0|October 07, 2025|Migration from powerapps-samples repository with solution repacking by [Jan Chlebek](https://github.com/jan-chlebek) +3.0|December 16, 2025|Add environment variables into solution by [Katerina Chernevskaya](https://github.com/Katerina-Chernevskaya) + +## Prerequisites + +This Flow requires the following list columns and settings: +* **Title** + * Settings: "Require that this column contains information" set to **Yes** +* **FolderLocation** + * Type: *Hyperlink* + +## Minimal Path to Awesome +* [Download](./solution/create-folder-with-link-back-to-list.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. + +* Test your *Flow* by adding a new item to your list. If successful the Flow will: + * Create a folder in our target *SharePoint* Document Library with a name that concatenates the *ID* and *Title* columns + * Update list item *FolderLocation* column to match the folder name +![Your flow ran successfully](./assets/flow-run.png) + +## Features + +This sample illustrates the following concepts: + +* Expressions +* SharePoint REST API +* Variables + + +## 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=create-folder-with-link-back-to-list&authors=@nyoung30&title=create-folder-with-link-back-to-list%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=create-folder-with-link-back-to-list&authors=@nyoung30&title=create-folder-with-link-back-to-list%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=create-folder-with-link-back-to-list&authors=@nyoung30&title=create-folder-with-link-back-to-list%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/create-folder-with-link-back-to-list/assets/configure-flow.png b/samples/create-folder-with-link-back-to-list/assets/configure-flow.png new file mode 100644 index 00000000..fac95eaf Binary files /dev/null and b/samples/create-folder-with-link-back-to-list/assets/configure-flow.png differ diff --git a/samples/create-folder-with-link-back-to-list/assets/flow-overview.png b/samples/create-folder-with-link-back-to-list/assets/flow-overview.png new file mode 100644 index 00000000..1eb3ae8b Binary files /dev/null and b/samples/create-folder-with-link-back-to-list/assets/flow-overview.png differ diff --git a/samples/create-folder-with-link-back-to-list/assets/flow-run.png b/samples/create-folder-with-link-back-to-list/assets/flow-run.png new file mode 100644 index 00000000..de395390 Binary files /dev/null and b/samples/create-folder-with-link-back-to-list/assets/flow-run.png differ diff --git a/samples/create-folder-with-link-back-to-list/assets/folder.png b/samples/create-folder-with-link-back-to-list/assets/folder.png new file mode 100644 index 00000000..481632e8 Binary files /dev/null and b/samples/create-folder-with-link-back-to-list/assets/folder.png differ diff --git a/samples/create-folder-with-link-back-to-list/assets/initialize-variable.png b/samples/create-folder-with-link-back-to-list/assets/initialize-variable.png new file mode 100644 index 00000000..fb1908d6 Binary files /dev/null and b/samples/create-folder-with-link-back-to-list/assets/initialize-variable.png differ diff --git a/samples/create-folder-with-link-back-to-list/assets/list-item.png b/samples/create-folder-with-link-back-to-list/assets/list-item.png new file mode 100644 index 00000000..eff96049 Binary files /dev/null and b/samples/create-folder-with-link-back-to-list/assets/list-item.png differ diff --git a/samples/create-folder-with-link-back-to-list/assets/previous-page.png b/samples/create-folder-with-link-back-to-list/assets/previous-page.png new file mode 100644 index 00000000..1091020a Binary files /dev/null and b/samples/create-folder-with-link-back-to-list/assets/previous-page.png differ diff --git a/samples/create-folder-with-link-back-to-list/assets/sample.json b/samples/create-folder-with-link-back-to-list/assets/sample.json new file mode 100644 index 00000000..f0e397f9 --- /dev/null +++ b/samples/create-folder-with-link-back-to-list/assets/sample.json @@ -0,0 +1,75 @@ +[ + { + "name": "pnp-powerplatform-samples-create-folder-with-link-back-to-list", + "source": "pnp", + "title": "Create folder with link back to list", + "shortDescription": "This sample creates a folder in a SharePoint document library and then stores the link to the newly created folder inside of Microsoft Lists using Power Automate.", + "url": "https://github.com/pnp/powerplatform-samples/tree/main/samples/create-folder-with-link-back-to-list", + "downloadUrl": "https://pnp.github.io/download-partial/?url=https://github.com/pnp/powerplatform-samples/tree/main/samples/create-folder-with-link-back-to-list", + "longDescription": [ + "This sample demonstrates how to create a folder in a SharePoint document library and store a link to that folder in a Microsoft Lists item using Power Automate. The folder name is based on a combination of list columns and provides a better link experience compared to the default URL." + ], + "creationDateTime": "2022-10-10", + "updateDateTime": "2025-12-16", + "products": [ + "Power Automate", + "PowerPlatform-samples" + ], + "tags": [ + "SharePoint", "Folder-URL" + ], + "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/create-folder-with-link-back-to-list/assets/flow-overview.png?raw=true", + "alt": "Preview PNG" + } + ], + "authors": [ + { + "gitHubAccount": "nyoung30", + "name": "Norm Young", + "pictureUrl": "https://avatars.githubusercontent.com/u/25697904?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/" + }, + { + "name": "Application Registration in Azure", + "description": "Application registration would be needed whenever we are trying to access any of the graph APIs", + "url": "https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-configure-app-access-web-apis" + } + ] + } +] diff --git a/samples/create-folder-with-link-back-to-list/assets/save.png b/samples/create-folder-with-link-back-to-list/assets/save.png new file mode 100644 index 00000000..678ad118 Binary files /dev/null and b/samples/create-folder-with-link-back-to-list/assets/save.png differ diff --git a/samples/create-folder-with-link-back-to-list/assets/turn-on.png b/samples/create-folder-with-link-back-to-list/assets/turn-on.png new file mode 100644 index 00000000..f972fda6 Binary files /dev/null and b/samples/create-folder-with-link-back-to-list/assets/turn-on.png differ diff --git a/samples/create-folder-with-link-back-to-list/assets/when-an-item-is-created.png b/samples/create-folder-with-link-back-to-list/assets/when-an-item-is-created.png new file mode 100644 index 00000000..8014959b Binary files /dev/null and b/samples/create-folder-with-link-back-to-list/assets/when-an-item-is-created.png differ diff --git a/samples/create-folder-with-link-back-to-list/solution/create-folder-with-link-back-to-list.zip b/samples/create-folder-with-link-back-to-list/solution/create-folder-with-link-back-to-list.zip new file mode 100644 index 00000000..e59d2e4c Binary files /dev/null and b/samples/create-folder-with-link-back-to-list/solution/create-folder-with-link-back-to-list.zip differ diff --git a/samples/create-folder-with-link-back-to-list/sourcecode/Other/Customizations.xml b/samples/create-folder-with-link-back-to-list/sourcecode/Other/Customizations.xml new file mode 100644 index 00000000..68e40231 --- /dev/null +++ b/samples/create-folder-with-link-back-to-list/sourcecode/Other/Customizations.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + SharePoint createfolderwithlinkbacktolist-eefbc + /providers/Microsoft.PowerApps/apis/shared_sharepointonline + 1 + 0 + 0 + 1 + + + + 1033 + + \ No newline at end of file diff --git a/samples/create-folder-with-link-back-to-list/sourcecode/Other/Solution.xml b/samples/create-folder-with-link-back-to-list/sourcecode/Other/Solution.xml new file mode 100644 index 00000000..84b5161d --- /dev/null +++ b/samples/create-folder-with-link-back-to-list/sourcecode/Other/Solution.xml @@ -0,0 +1,89 @@ + + + + createfolderwithlinkbacktolist + + + + + + + 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/create-folder-with-link-back-to-list/sourcecode/Workflows/Createfolderwithlinkbacktolist-BD0B9CDF-BDA3-F011-BBD3-0022480B4618.json b/samples/create-folder-with-link-back-to-list/sourcecode/Workflows/Createfolderwithlinkbacktolist-BD0B9CDF-BDA3-F011-BBD3-0022480B4618.json new file mode 100644 index 00000000..7b8e706f --- /dev/null +++ b/samples/create-folder-with-link-back-to-list/sourcecode/Workflows/Createfolderwithlinkbacktolist-BD0B9CDF-BDA3-F011-BBD3-0022480B4618.json @@ -0,0 +1,191 @@ +{ + "properties": { + "connectionReferences": { + "shared_sharepointonline_1": { + "runtimeSource": "embedded", + "connection": { + "connectionReferenceLogicalName": "pnp_sharedsharepointonline_eefbc" + }, + "api": { + "name": "shared_sharepointonline" + } + } + }, + "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" + }, + "ev_site (pnp_ev_site)": { + "defaultValue": "https://chernevskayakaterinagmail.sharepoint.com/sites/pnp", + "type": "String", + "metadata": { + "schemaName": "pnp_ev_site" + } + }, + "ev_list (pnp_ev_list)": { + "defaultValue": "741c500e-a7a2-4def-993c-d5caea74e331", + "type": "String", + "metadata": { + "schemaName": "pnp_ev_list" + } + } + }, + "triggers": { + "When_an_item_is_created": { + "recurrence": { + "interval": 1, + "frequency": "Minute" + }, + "splitOn": "@triggerOutputs()?['body/value']", + "metadata": { + "operationMetadataId": "7890832d-bafb-455f-b25a-c834fa6eb2b1" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_sharepointonline_1", + "operationId": "GetOnNewItems", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline" + }, + "parameters": { + "dataset": "@parameters('ev_site (pnp_ev_site)')", + "table": "@parameters('ev_list (pnp_ev_list)')" + }, + "authentication": "@parameters('$authentication')" + }, + "description": "Replace Site Address and List Name to match your site and list." + } + }, + "actions": { + "Create_new_folder": { + "runAfter": { + "Compose_-_varParameters": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "ea64d6e9-1fcb-4f4f-a2eb-79d3e1cc637d" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_sharepointonline_1", + "operationId": "CreateNewFolder", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline" + }, + "parameters": { + "dataset": "@variables('varParameters')['varSiteURL']", + "table": "@variables('varParameters')['varDocumentDisplayLibraryName']", + "parameters/path": "@variables('varParameters')['varFolderName']" + }, + "authentication": "@parameters('$authentication')" + }, + "description": "If you rename this action be certain to update the outputs('Create_new_folder')?['body/{Link}'] expression included in the Send an HTTP request to SharePoint action" + }, + "Send_an_HTTP_request_to_SharePoint": { + "runAfter": { + "Send_an_HTTP_request_to_SharePoint_2": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "4140c059-c011-4c02-a159-3e375dd82090" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_sharepointonline_1", + "operationId": "HttpRequest", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline" + }, + "parameters": { + "dataset": "@variables('varParameters')['varSiteURL']", + "parameters/method": "POST", + "parameters/uri": "_api/web/lists(guid'@{parameters('ev_list (pnp_ev_list)')}')/items(@{triggerOutputs()?['body/ID']})", + "parameters/headers": { + "Content-Type": "application/json;odata=nometadata", + "X-HTTP-Method": "MERGE", + "IF-MATCH": "*" + }, + "parameters/body": "{'FolderLocation': {'Url':'@{outputs('Create_new_folder')?['body/{Link}']}'}}" + }, + "authentication": "@parameters('$authentication')" + } + }, + "Initialize_variable_-_varParameters": { + "runAfter": {}, + "metadata": { + "operationMetadataId": "09ded3eb-54e7-4bdd-a8b6-598cf57fa4f6" + }, + "type": "InitializeVariable", + "inputs": { + "variables": [ + { + "name": "varParameters", + "type": "object", + "value": { + "varSiteURL": "@{parameters('ev_site (pnp_ev_site)')}", + "varListInternalName": "@{parameters('ev_list (pnp_ev_list)')}", + "varListDisplayName": "@{parameters('ev_list (pnp_ev_list)')}", + "varColumnInternalName": "FolderLocation", + "varDocumentDisplayLibraryName": "Documents", + "varFolderName": "@{concat(triggerOutputs()?['body/ID'], '-', triggerOutputs()?['body/Title'])}" + } + } + ] + }, + "description": "The Object variable type is used in place of multiple variable declarations. See Comments for notes on each object variable in varParameters." + }, + "Compose_-_varParameters": { + "runAfter": { + "Initialize_variable_-_varParameters": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "4850603d-5ac6-48b7-aac7-ff9cb236aa35" + }, + "type": "Compose", + "inputs": "@variables('varParameters')" + }, + "Send_an_HTTP_request_to_SharePoint_2": { + "runAfter": { + "Create_new_folder": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "4140c059-c011-4c02-a159-3e375dd82090" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_sharepointonline_1", + "operationId": "HttpRequest", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline" + }, + "parameters": { + "dataset": "@parameters('ev_site (pnp_ev_site)')", + "parameters/method": "GET", + "parameters/uri": "_api/web/lists(guid'@{parameters('ev_list (pnp_ev_list)')}')/fields?$select=Title,InternalName,TypeAsString&$filter=Hidden eq false and ReadOnlyField eq false", + "parameters/headers": { + "Accept": "application/json;odata=nometadata" + } + }, + "authentication": "@parameters('$authentication')" + } + } + } + }, + "templateName": "" + }, + "schemaVersion": "1.0.0.0" +} \ No newline at end of file diff --git a/samples/create-folder-with-link-back-to-list/sourcecode/Workflows/Createfolderwithlinkbacktolist-BD0B9CDF-BDA3-F011-BBD3-0022480B4618.json.data.xml b/samples/create-folder-with-link-back-to-list/sourcecode/Workflows/Createfolderwithlinkbacktolist-BD0B9CDF-BDA3-F011-BBD3-0022480B4618.json.data.xml new file mode 100644 index 00000000..f06ca41f --- /dev/null +++ b/samples/create-folder-with-link-back-to-list/sourcecode/Workflows/Createfolderwithlinkbacktolist-BD0B9CDF-BDA3-F011-BBD3-0022480B4618.json.data.xml @@ -0,0 +1,27 @@ + + + /Workflows/Createfolderwithlinkbacktolist-BD0B9CDF-BDA3-F011-BBD3-0022480B4618.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 diff --git a/samples/create-folder-with-link-back-to-list/sourcecode/environmentvariabledefinitions/pnp_ev_list/environmentvariabledefinition.xml b/samples/create-folder-with-link-back-to-list/sourcecode/environmentvariabledefinitions/pnp_ev_list/environmentvariabledefinition.xml new file mode 100644 index 00000000..e02da257 --- /dev/null +++ b/samples/create-folder-with-link-back-to-list/sourcecode/environmentvariabledefinitions/pnp_ev_list/environmentvariabledefinition.xml @@ -0,0 +1,16 @@ + + /providers/microsoft.powerapps/apis/shared_sharepointonline + 741c500e-a7a2-4def-993c-d5caea74e331 + + + 1.0.0.0 + 1 + 0 + table + + pnp_ev_site + + 0 + 100000004 + \ No newline at end of file diff --git a/samples/create-folder-with-link-back-to-list/sourcecode/environmentvariabledefinitions/pnp_ev_site/environmentvariabledefinition.xml b/samples/create-folder-with-link-back-to-list/sourcecode/environmentvariabledefinitions/pnp_ev_site/environmentvariabledefinition.xml new file mode 100644 index 00000000..41cfe0f4 --- /dev/null +++ b/samples/create-folder-with-link-back-to-list/sourcecode/environmentvariabledefinitions/pnp_ev_site/environmentvariabledefinition.xml @@ -0,0 +1,12 @@ + + /providers/microsoft.powerapps/apis/shared_sharepointonline + + + 1.0.0.0 + 1 + 0 + dataset + 0 + 100000004 + \ No newline at end of file