{"id":50,"date":"2020-06-16T09:38:35","date_gmt":"2020-06-16T08:38:35","guid":{"rendered":"http:\/\/m365-blog.de\/?p=50"},"modified":"2020-06-16T09:42:33","modified_gmt":"2020-06-16T08:42:33","slug":"upload-a-document-to-a-document-library-and-pass-properties-with-powerapps","status":"publish","type":"post","link":"https:\/\/m365-blog.de\/?p=50","title":{"rendered":"Upload a document to a Document Library and pass properties with PowerApps"},"content":{"rendered":"\n<p>Due to the fact, that it is currently not possible to simply integrate an upload functionality for a document library, I searched for alternate solutions.<\/p>\n\n\n\n<p>In detail, an upload and passing Metadata to a SharePoint document library is divided in two steps. First you must upload a document to the library. Afterwards you can update the metadata information. That would require that a PowerApp must wait for something like a callback with a 200 message or at least an \u201cupload successfull\u201d information.<\/p>\n\n\n\n<p>Some of you may notice that a standard SharePoint List comes with a column \u201cAttachments\u201d. This will allow us to trigger an upload action. The plan is to use a list to upload a document, pass the information in the fields and copy the document to the library with Power Automate. The following components are necessary:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1654\" height=\"451\" src=\"https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/UploadDoc.jpg\" alt=\"\" class=\"wp-image-51\" srcset=\"https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/UploadDoc.jpg 1654w, https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/UploadDoc-300x82.jpg 300w, https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/UploadDoc-1024x279.jpg 1024w, https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/UploadDoc-768x209.jpg 768w, https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/UploadDoc-1536x419.jpg 1536w\" sizes=\"auto, (max-width: 1654px) 100vw, 1654px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>SharePoint List with a custom column \u201cProperty1\u201d (Single Line of Text)<\/strong><\/li><li><strong>SharePoint Document Library with a custom column \u201cProperty1\u201d (Single Line of Text)<\/strong><\/li><li><strong>A Flow in Power Automate<\/strong><\/li><li><strong>A PowerApp<\/strong><\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">The Flow<\/h2>\n\n\n\n<p>First, we need a trigger. In our case we will use \u201cWhen item is created\u201d from a SharePoint List.<\/p>\n\n\n\n<p>Second step is to get all attachments. Why multiple!? Because it is possible to upload multiple documents with the functionality and we have to catch that case.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1687\" height=\"1172\" src=\"https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/FlowP1.jpg\" alt=\"\" class=\"wp-image-52\" srcset=\"https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/FlowP1.jpg 1687w, https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/FlowP1-300x208.jpg 300w, https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/FlowP1-1024x711.jpg 1024w, https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/FlowP1-768x534.jpg 768w, https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/FlowP1-1536x1067.jpg 1536w\" sizes=\"auto, (max-width: 1687px) 100vw, 1687px\" \/><\/figure>\n\n\n\n<p>Afterwards we must loop through each attachment object. The first action in the loop is \u201cGet Attachment content\u201d, with that data we can create a file as a next step. The last step would be to update the file properties. In our case it is a simple Single Line of Text field, but for sure it can be any type of column.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"968\" height=\"1435\" src=\"https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/FlowP22.jpg\" alt=\"\" class=\"wp-image-55\" srcset=\"https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/FlowP22.jpg 968w, https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/FlowP22-202x300.jpg 202w, https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/FlowP22-691x1024.jpg 691w, https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/FlowP22-768x1139.jpg 768w\" sizes=\"auto, (max-width: 968px) 100vw, 968px\" \/><\/figure>\n\n\n\n<p>It is a simple and straight forward Flow:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"912\" height=\"1024\" src=\"https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/FlowP3-912x1024.jpg\" alt=\"\" class=\"wp-image-56\" srcset=\"https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/FlowP3-912x1024.jpg 912w, https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/FlowP3-267x300.jpg 267w, https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/FlowP3-768x862.jpg 768w, https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/FlowP3.jpg 1054w\" sizes=\"auto, (max-width: 912px) 100vw, 912px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">PowerApp<\/h2>\n\n\n\n<p>The last step in our use case would be to integrate the functionality into a Canvas PowerApp. For that, we have to insert a form for the created SharePoint List.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Insert a Datasource &#8211; SharePoint<\/li><li>Select the corresponding SharePoint site<\/li><li>Select the created custom list <\/li><li>Insert an Edit Form via the Insert tab &#8211; Forms<\/li><li>Select the list as a DataSource on the property pane on the right side<\/li><li>Change the default Mode to New in the property pane<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"2286\" height=\"1113\" src=\"https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/PA1.jpg\" alt=\"\" class=\"wp-image-57\" srcset=\"https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/PA1.jpg 2286w, https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/PA1-300x146.jpg 300w, https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/PA1-1024x499.jpg 1024w, https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/PA1-768x374.jpg 768w, https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/PA1-1536x748.jpg 1536w, https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/PA1-2048x997.jpg 2048w\" sizes=\"auto, (max-width: 2286px) 100vw, 2286px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>Add a button and insert the function for the property &#8220;onSelect&#8221; &#8211; SubmitForm(Form1);NewForm(Form1);<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1604\" height=\"1030\" src=\"https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/PA2.jpg\" alt=\"\" class=\"wp-image-58\" srcset=\"https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/PA2.jpg 1604w, https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/PA2-300x193.jpg 300w, https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/PA2-1024x658.jpg 1024w, https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/PA2-768x493.jpg 768w, https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/PA2-1536x986.jpg 1536w\" sizes=\"auto, (max-width: 1604px) 100vw, 1604px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>To get a feedback we change in the form the property &#8220;OnSuccess&#8221; &#8211; Notify(&#8220;Successfully uploaded&#8221;, NotificationType.Success)<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1676\" height=\"73\" src=\"https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/PA3.jpg\" alt=\"\" class=\"wp-image-59\" srcset=\"https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/PA3.jpg 1676w, https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/PA3-300x13.jpg 300w, https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/PA3-1024x45.jpg 1024w, https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/PA3-768x33.jpg 768w, https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/PA3-1536x67.jpg 1536w\" sizes=\"auto, (max-width: 1676px) 100vw, 1676px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>Test it \ud83d\ude42<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1838\" height=\"1251\" src=\"https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/p4.jpg\" alt=\"\" class=\"wp-image-60\" srcset=\"https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/p4.jpg 1838w, https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/p4-300x204.jpg 300w, https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/p4-1024x697.jpg 1024w, https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/p4-768x523.jpg 768w, https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/p4-1536x1045.jpg 1536w\" sizes=\"auto, (max-width: 1838px) 100vw, 1838px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1833\" height=\"774\" src=\"https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/pa5.jpg\" alt=\"\" class=\"wp-image-61\" srcset=\"https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/pa5.jpg 1833w, https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/pa5-300x127.jpg 300w, https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/pa5-1024x432.jpg 1024w, https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/pa5-768x324.jpg 768w, https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/pa5-1536x649.jpg 1536w\" sizes=\"auto, (max-width: 1833px) 100vw, 1833px\" \/><\/figure>\n\n\n\n<p>The final result can be seen in the document library. <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"2243\" height=\"385\" src=\"https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/doclib.jpg\" alt=\"\" class=\"wp-image-62\" srcset=\"https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/doclib.jpg 2243w, https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/doclib-300x51.jpg 300w, https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/doclib-1024x176.jpg 1024w, https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/doclib-768x132.jpg 768w, https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/doclib-1536x264.jpg 1536w, https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/doclib-2048x352.jpg 2048w\" sizes=\"auto, (max-width: 2243px) 100vw, 2243px\" \/><\/figure>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Due to the fact, that it is currently not possible to simply integrate an upload functionality for a document library, I searched for alternate solutions. In detail, an upload and passing Metadata to a SharePoint document library is divided in two steps. First you must upload a document to the library. Afterwards you can update the metadata information. That would [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":56,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","footnotes":""},"categories":[3,4,2],"tags":[17,13,18],"class_list":["post-50","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-power-apps","category-power-automate","category-power-plattform","tag-powerapps","tag-powerautomate","tag-uploaddocument"],"uagb_featured_image_src":{"full":["https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/FlowP3.jpg",1054,1183,false],"thumbnail":["https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/FlowP3-150x150.jpg",150,150,true],"medium":["https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/FlowP3-267x300.jpg",267,300,true],"medium_large":["https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/FlowP3-768x862.jpg",640,718,true],"large":["https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/FlowP3-912x1024.jpg",640,719,true],"elegant_blocks_team_1":["https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/FlowP3-500x500.jpg",500,500,true],"elegant_blocks_blog_1":["https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/FlowP3-693x462.jpg",693,462,true],"elegant_blocks_slider_1":["https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/FlowP3-1054x1000.jpg",1054,1000,true],"1536x1536":["https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/FlowP3.jpg",1054,1183,false],"2048x2048":["https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/FlowP3.jpg",1054,1183,false],"bizberg_medium":["https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/FlowP3-300x300.jpg",300,300,true],"bizberg_gallery":["https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/FlowP3-500x400.jpg",500,400,true],"bizberg_blog_list":["https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/FlowP3-368x240.jpg",368,240,true],"bizberg_detail_image":["https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/FlowP3-825x400.jpg",825,400,true],"bizberg_detail_image_no_sidebar":["https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/FlowP3-920x400.jpg",920,400,true],"bizberg_portfolio_homepage":["https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/FlowP3-600x400.jpg",600,400,true],"bizberg_blog_list_no_sidebar_1":["https:\/\/m365-blog.de\/wp-content\/uploads\/2020\/06\/FlowP3-220x190.jpg",220,190,true]},"uagb_author_info":{"display_name":"m365admin","author_link":"https:\/\/m365-blog.de\/?author=1"},"uagb_comment_info":4,"uagb_excerpt":"Due to the fact, that it is currently not possible to simply integrate an upload functionality for a document library, I searched for alternate solutions. In detail, an upload and passing Metadata to a SharePoint document library is divided in two steps. First you must upload a document to the library. Afterwards you can update&hellip;","_links":{"self":[{"href":"https:\/\/m365-blog.de\/index.php?rest_route=\/wp\/v2\/posts\/50","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/m365-blog.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/m365-blog.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/m365-blog.de\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/m365-blog.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=50"}],"version-history":[{"count":1,"href":"https:\/\/m365-blog.de\/index.php?rest_route=\/wp\/v2\/posts\/50\/revisions"}],"predecessor-version":[{"id":63,"href":"https:\/\/m365-blog.de\/index.php?rest_route=\/wp\/v2\/posts\/50\/revisions\/63"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/m365-blog.de\/index.php?rest_route=\/wp\/v2\/media\/56"}],"wp:attachment":[{"href":"https:\/\/m365-blog.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=50"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/m365-blog.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=50"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/m365-blog.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=50"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}