{"id":6240,"date":"2024-10-28T02:38:47","date_gmt":"2024-10-28T02:38:47","guid":{"rendered":"https:\/\/powergi.net\/?p=6240"},"modified":"2026-06-19T18:29:44","modified_gmt":"2026-06-19T18:29:44","slug":"canvas-apps-download-files-from-dataverse","status":"publish","type":"post","link":"https:\/\/powergi.net\/es\/blog\/canvas-apps-download-files-from-dataverse\/","title":{"rendered":"Canvas Apps: Download file from Dataverse | Avoid 401 error | Works from any device | PowerApps"},"content":{"rendered":"<h4>Table of Contents<\/h4>\n<p>When working with <a href=\"https:\/\/powergi.net\/\"><b>Canvas Apps<\/b><\/a> in Power Apps, Dataverse and file columns, it\u2019s very common to want to have a \u201cdownload\u201d button that lets the user save a copy of the file in their local computer.<\/p>\n<p>This can be achieved in a way by using Dataverse API with the following endpoint:<\/p>\n<p>{environment-url}\/api\/data\/v9.0\/table_logical_name({record-id})\/column_logical_name\/$value<\/p>\n<p>However, this link will fail with 401 error in mobile and also if the user is not logged into Dynamics already \u2013 which is in almost all cases.<\/p>\n<p>But don\u2019t you worry! In this blog we will show you a workaround using Power Automate that will avoid all 401 errors that could happen.<\/p>\n<p><strong>Turn your ideas into digital solutions<\/strong><\/p>\n<p>Our team guides you step by step to build custom apps in Power Platform. Because in many cases this type of functionality\u2014where users need to reliably download files from various environments\u2014involves cross-functional planning, organizations may engage <a href=\"https:\/\/powergi.net\/power-apps-consulting-services\/\"><strong>business application development services<\/strong> <\/a>to ensure the solution works smoothly across devices and contexts.<\/p><div id=\"seology-cta-1\">\t\t<div data-elementor-type=\"section\" data-elementor-id=\"7280\" class=\"elementor elementor-7280\" data-elementor-post-type=\"elementor_library\">\n\t\t\t<div class=\"elementor-element elementor-element-7e3f164 e-con-full e-flex e-con e-parent\" data-id=\"7e3f164\" data-element_type=\"container\" data-e-type=\"container\" data-settings='{\"background_background\":\"classic\",\"jet_parallax_layout_list\":[]}'>\n\t\t<div class=\"elementor-element elementor-element-9078c9f e-con-full e-flex e-con e-child\" data-id=\"9078c9f\" data-element_type=\"container\" data-e-type=\"container\" data-settings='{\"jet_parallax_layout_list\":[]}'>\n\t\t\t\t<div class=\"elementor-element elementor-element-7b99949 elementor-widget elementor-widget-heading\" data-id=\"7b99949\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<p class=\"elementor-heading-title elementor-size-default\">Automate tasks that slow you down<\/p>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-8e61db5 elementor-widget elementor-widget-heading\" data-id=\"8e61db5\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<p class=\"elementor-heading-title elementor-size-default\">Free up your team\u2019s time and focus on strategic work with digital and robotic automation.<\/p>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-a578907 e-flex e-con-boxed e-con e-child\" data-id=\"a578907\" data-element_type=\"container\" data-e-type=\"container\" data-settings='{\"jet_parallax_layout_list\":[]}'>\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-e8c827b elementor-view-stacked elementor-shape-circle elementor-widget elementor-widget-icon\" data-id=\"e8c827b\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"icon.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-icon-wrapper\">\n\t\t\t<a class=\"elementor-icon\" href=\"#ctc_chat\">\n\t\t\t<i aria-hidden=\"true\" class=\"fab fa-whatsapp\"><\/i>\t\t\t<\/a>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-d834237 elementor-view-stacked elementor-shape-circle elementor-widget elementor-widget-icon\" data-id=\"d834237\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"icon.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-icon-wrapper\">\n\t\t\t<a class=\"elementor-icon\" href=\"https:\/\/powergi.net\/es\/contact\/\">\n\t\t\t<i aria-hidden=\"true\" class=\"far fa-envelope\"><\/i>\t\t\t<\/a>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<\/div>\n<h2>Solution description<\/h2>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\">We will create a Power Automate workflow with a \u201cHTTP request\u201d trigger (which will receive the record ID for which we want to download the file). This approach is commonly recommended by <a href=\"https:\/\/powergi.net\/microsoft-power-platform-consulting-services\/\"><strong>Power Platform consulting services<\/strong><\/a> to enhance file accessibility and ensure security compliance.<\/li>\n<\/ul>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\">We will use the Dataverse connector actions in <a href=\"https:\/\/powergi.net\/blog\/cancel-old-approval-requests-sent-from-power-automate-dataverse-approvals\/\"><b>Power Automate<\/b><\/a> to download the file content<\/li>\n<\/ul>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\">We will return to the user the file content, and this will make the file to be automatically downloaded when user clicks the button in the canvas app<\/li>\n<\/ul>\n<h2>Step 1. Create Power Automate workflow<\/h2>\n<p>Start by creating a new flow and select the \u201cinstant cloud flow\u201d type and select the \u201cWhen an HTTP request is received\u201d trigger.<\/p>\n<p><img fetchpriority=\"high\" decoding=\"async\" src=\"https:\/\/powergi.net\/wp-content\/uploads\/2024\/11\/unnamed-32.png\" sizes=\"(max-width: 512px) 100vw, 512px\" srcset=\"https:\/\/powergi.net\/wp-content\/uploads\/2024\/11\/unnamed-32.png 512w, https:\/\/powergi.net\/wp-content\/uploads\/2024\/11\/unnamed-32-300x193.png 300w\" alt=\"Instant Cloud flow\" width=\"512\" height=\"330\"><\/p>\n<p>Configure trigger as follows<\/p>\n<p>Who can trigger the flow?: Anyone<\/p>\n<p>Method: GET<\/p>\n<p>Relative path: {guid}<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/powergi.net\/wp-content\/uploads\/2024\/11\/unnamed-33.png\" sizes=\"(max-width: 512px) 100vw, 512px\" srcset=\"https:\/\/powergi.net\/wp-content\/uploads\/2024\/11\/unnamed-33.png 512w, https:\/\/powergi.net\/wp-content\/uploads\/2024\/11\/unnamed-33-300x215.png 300w\" alt=\"\" width=\"512\" height=\"367\"><\/p>\n<h2>Step 2. Extract file name<\/h2>\n<p>Use the \u201cGet row by ID\u201d action from the <a href=\"https:\/\/powergi.net\/data-and-analytics\/\"><b>Dataverse connector<\/b><\/a> and pass the \u201cguid\u201d variable in the flow that comes from the trigger as \u201cRow ID\u201d<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/powergi.net\/wp-content\/uploads\/2024\/11\/unnamed-34.png\" sizes=\"(max-width: 512px) 100vw, 512px\" srcset=\"https:\/\/powergi.net\/wp-content\/uploads\/2024\/11\/unnamed-34.png 512w, https:\/\/powergi.net\/wp-content\/uploads\/2024\/11\/unnamed-34-300x91.png 300w\" alt=\"Get row by ID\" width=\"512\" height=\"156\"><\/p>\n<h2>Step 3. Extract file content<\/h2>\n<p>Add the \u201cDownload a file or an image\u201d action from the Dataverse connection, select the relevant table and column and pass the \u201cGuid\u201d variable as the value for \u201crow id\u201d.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/powergi.net\/wp-content\/uploads\/2024\/11\/unnamed-35.png\" sizes=\"(max-width: 512px) 100vw, 512px\" srcset=\"https:\/\/powergi.net\/wp-content\/uploads\/2024\/11\/unnamed-35.png 512w, https:\/\/powergi.net\/wp-content\/uploads\/2024\/11\/unnamed-35-300x127.png 300w\" alt=\"\" width=\"512\" height=\"217\"><\/p>\n<h2>Step 4. Return file to user<\/h2>\n<p>Add the \u201cResponse\u201d action as the final step for the workflow. We will rename to \u201cSend file to user\u201d<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/powergi.net\/wp-content\/uploads\/2024\/11\/unnamed-36.png\" sizes=\"(max-width: 512px) 100vw, 512px\" srcset=\"https:\/\/powergi.net\/wp-content\/uploads\/2024\/11\/unnamed-36.png 512w, https:\/\/powergi.net\/wp-content\/uploads\/2024\/11\/unnamed-36-300x39.png 300w\" alt=\"Response request\" width=\"512\" height=\"66\"><\/p>\n<p>Set up the action as follows:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/powergi.net\/wp-content\/uploads\/2024\/11\/unnamed-37.png\" sizes=\"(max-width: 512px) 100vw, 512px\" srcset=\"https:\/\/powergi.net\/wp-content\/uploads\/2024\/11\/unnamed-37.png 512w, https:\/\/powergi.net\/wp-content\/uploads\/2024\/11\/unnamed-37-300x153.png 300w\" alt=\"Column for send file to user\" width=\"512\" height=\"261\"><\/p>\n<p>Status code: 200<\/p>\n<p>Headers:<\/p>\n<p>Content-Type application\/octet-stream<\/p>\n<p>Content-Disposition attachment;filename=\u201d{file-name-from-table}\u201d<\/p>\n<p>Body: @{base64ToBinary(body(\u2018Download_file\u2019)?[\u2018$content\u2019])} (Power Fx expression to convert the Dataverse file from Base64 to Binary).<\/p>\n<h2>Step 5. Add Download function in Power Apps<\/h2>\n<p>This is the code you should add in the button or icon that will download the files from Dataverse in the app:<\/p><div id=\"seology-cta-2\">\t\t<div data-elementor-type=\"section\" data-elementor-id=\"7531\" class=\"elementor elementor-7531\" data-elementor-post-type=\"elementor_library\">\n\t\t\t<div class=\"elementor-element elementor-element-7e3f164 e-con-full e-flex e-con e-parent\" data-id=\"7e3f164\" data-element_type=\"container\" data-e-type=\"container\" data-settings='{\"background_background\":\"classic\",\"jet_parallax_layout_list\":[]}'>\n\t\t<div class=\"elementor-element elementor-element-9078c9f e-con-full e-flex e-con e-child\" data-id=\"9078c9f\" data-element_type=\"container\" data-e-type=\"container\" data-settings='{\"jet_parallax_layout_list\":[]}'>\n\t\t\t\t<div class=\"elementor-element elementor-element-7b99949 elementor-widget elementor-widget-heading\" data-id=\"7b99949\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<p class=\"elementor-heading-title elementor-size-default\">Are you ready to discover the joy of automation?<\/p>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-8e61db5 elementor-widget elementor-widget-heading\" data-id=\"8e61db5\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<p class=\"elementor-heading-title elementor-size-default\">Whether you have a project in mind or just want to know how we can help, we\u2019re happy to have a conversation<\/p>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-a578907 e-flex e-con-boxed e-con e-child\" data-id=\"a578907\" data-element_type=\"container\" data-e-type=\"container\" data-settings='{\"jet_parallax_layout_list\":[]}'>\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-e8c827b elementor-view-stacked elementor-shape-circle elementor-widget elementor-widget-icon\" data-id=\"e8c827b\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"icon.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-icon-wrapper\">\n\t\t\t<a class=\"elementor-icon\" href=\"#ctc_chat\">\n\t\t\t<i aria-hidden=\"true\" class=\"fab fa-whatsapp\"><\/i>\t\t\t<\/a>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-d834237 elementor-view-stacked elementor-shape-circle elementor-widget elementor-widget-icon\" data-id=\"d834237\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"icon.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-icon-wrapper\">\n\t\t\t<a class=\"elementor-icon\" href=\"https:\/\/powergi.net\/es\/contact\/\">\n\t\t\t<i aria-hidden=\"true\" class=\"far fa-envelope\"><\/i>\t\t\t<\/a>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<\/div>\n<p>Download(HTTP_GET_URL_FROM_POWER_AUTOMATE)<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/powergi.net\/wp-content\/uploads\/2024\/11\/unnamed-39.png\" sizes=\"(max-width: 512px) 100vw, 512px\" srcset=\"https:\/\/powergi.net\/wp-content\/uploads\/2024\/11\/unnamed-39.png 512w, https:\/\/powergi.net\/wp-content\/uploads\/2024\/11\/unnamed-39-300x120.png 300w\" alt=\"HTTP request received column\" width=\"512\" height=\"205\"><\/p>\n<p>Copy the URL from Power Automate and replace the \u201c{guid}\u201d part by the Record GUID from the Dataverse table that contains the attachment.<\/p>\n<p>Download(Substitute(HTTP_GET_URL_FROM_POWER_AUTOMATE, \u201c{guid}\u201d,ThisItem.FileRecordID)<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/powergi.net\/wp-content\/uploads\/2024\/11\/unnamed-38.png\" sizes=\"(max-width: 512px) 100vw, 512px\" srcset=\"https:\/\/powergi.net\/wp-content\/uploads\/2024\/11\/unnamed-38.png 512w, https:\/\/powergi.net\/wp-content\/uploads\/2024\/11\/unnamed-38-300x82.png 300w\" alt=\"Power Automate\" width=\"512\" height=\"140\"><\/p>\n<p>To further enhance your Power Apps experience, consider our <a href=\"https:\/\/powergi.net\/microsoft-power-platform-consulting-services\/\"><strong>Power platform consulting services<\/strong><\/a>. These services empower our clients to streamline app functionality while ensuring seamless file accessibility, even across various devices and environments. By integrating advanced Power Automate workflows, we mitigate potential issues such as the common 401 error. Our expertise guarantees a user-friendly and secure solution tailored to your organizational needs.<\/p>\n<p>In short, <a href=\"https:\/\/powergi.net\/\"><b>Power GI<\/b><\/a>\u2019s method lets you add an easy download button in Canvas Apps that works smoothly on any device. Using Power Automate, this approach avoids 401 errors, so users can access files hassle-free, even if they aren\u2019t logged into Dynamics.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Table of Contents When working with Canvas Apps in Power Apps, Dataverse and file columns, it\u2019s very common to want to have a \u201cdownload\u201d button that lets the user save a copy of the file in their local computer. This can be achieved in a way by using Dataverse API with the following endpoint: {environment-url}\/api\/data\/v9.0\/table_logical_name({record-id})\/column_logical_name\/$value [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":6248,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"default","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"glossary_letter":"a","footnotes":""},"categories":[155],"tags":[156,161,17],"class_list":["post-6240","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-canvas-apps","tag-canvas-apps","tag-dataverse-connector","tag-power-automate"],"glossary_letter":"a","rank_math_title":"Canvas Apps: Complete Guide","rank_math_description":"Master Canvas Apps with our complete guide! Practical tips to avoid 401 errors and optimize performance effortlessly","rank_math_focus_keyword":"powerapps download file from dataverse","_links":{"self":[{"href":"https:\/\/powergi.net\/es\/wp-json\/wp\/v2\/posts\/6240","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/powergi.net\/es\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/powergi.net\/es\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/powergi.net\/es\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/powergi.net\/es\/wp-json\/wp\/v2\/comments?post=6240"}],"version-history":[{"count":1,"href":"https:\/\/powergi.net\/es\/wp-json\/wp\/v2\/posts\/6240\/revisions"}],"predecessor-version":[{"id":13621,"href":"https:\/\/powergi.net\/es\/wp-json\/wp\/v2\/posts\/6240\/revisions\/13621"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/powergi.net\/es\/wp-json\/wp\/v2\/media\/6248"}],"wp:attachment":[{"href":"https:\/\/powergi.net\/es\/wp-json\/wp\/v2\/media?parent=6240"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/powergi.net\/es\/wp-json\/wp\/v2\/categories?post=6240"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/powergi.net\/es\/wp-json\/wp\/v2\/tags?post=6240"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}