{"id":365,"date":"2023-02-20T11:55:00","date_gmt":"2023-02-20T11:55:00","guid":{"rendered":"https:\/\/automatethemundane.com\/index.php\/2023\/02\/20\/setting-up-custom-sharepoint-connections-to-dataverse-record\/"},"modified":"2023-06-28T00:23:32","modified_gmt":"2023-06-28T00:23:32","slug":"setting-up-custom-sharepoint-connections-to-dataverse-record","status":"publish","type":"post","link":"https:\/\/automatethemundane.com\/index.php\/2023\/02\/20\/setting-up-custom-sharepoint-connections-to-dataverse-record\/","title":{"rendered":"Setting up Custom SharePoint Connections to Dataverse Record"},"content":{"rendered":"\n<p class=\"has-text-color wp-block-paragraph\" style=\"color:rgba(120, 119, 116, 1)\">2\/20\/2023<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">The Why<\/h1>\n\n\n\n<p class=\"has-text-color wp-block-paragraph\" style=\"color:rgb(0, 0, 0)\">When integrating Dataverse and SharePoint, it's important to segregate documents from the default site. This helps ensure that only authorized users have access to the document libraries. By keeping the libraries separate, you can maintain better control over the documents and their distribution.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">The How<\/h1>\n\n\n\n<p class=\"has-text-color wp-block-paragraph\" style=\"color:rgb(0, 0, 0)\">Prior to using this guide the Default site needs to be configured<\/p>\n\n\n\n<p class=\"has-text-color wp-block-paragraph\" style=\"color:rgb(0, 0, 0)\"><a href=\"https:\/\/automatethemundane.com\/index.php\/2023\/02\/20\/setting-up-default-sharepoint-connections-to-dataverse-record\/\" target=\"_blank\" rel=\"noreferrer noopener\">Setting up Default SharePoint Connections to Dataverse Record<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Setting up the SharePoint Document Library<\/h2>\n\n\n\n<p class=\"has-text-color wp-block-paragraph\" style=\"color:rgb(0, 0, 0)\">Because we are not using the default site, we will need to create the SharePoint Document library. From the desired SharePoint Site navigate to Site Content and create a new document library<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/06\/image-20.png\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"has-text-color wp-block-paragraph\" style=\"color:rgb(0, 0, 0)\">Give the library a distinct name, we will be using this in a later step. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/06\/image-21.png\" alt=\"\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/06\/image-22-1024x550.png\" alt=\"\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Setting up the SharePoint Connection<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Select SharePoint Sites<\/li>\n\n\n\n<li>Select New<\/li>\n\n\n\n<li>Give the site a unique name and type in the URL to the SP site<\/li>\n\n\n\n<li>Save the Site and the Document Location. <\/li>\n\n\n\n<li>Select SharePoint Document Locations<\/li>\n\n\n\n<li>Select New<\/li>\n\n\n\n<li>Give the location a distinct name<\/li>\n\n\n\n<li>Under Parent Site, use the SharePoint site created above, for the relative URL enter in the SharePoint Document Location that was created earlier. <\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/06\/image-23-1024x495.png\" alt=\"\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Creating the folder<\/h2>\n\n\n\n<p class=\"has-text-color wp-block-paragraph\" style=\"color:rgb(0, 0, 0)\">Since we are not using the default site, Dataverse will not automatically create a SharePoint folder when a new record is added. To solve this issue, we need to create a Power Automate Flow to generate the folder for us.<\/p>\n\n\n\n<p class=\"has-text-color wp-block-paragraph\" style=\"color:rgb(0, 0, 0)\">The Trigger is when a row is added to the Table<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/06\/image-24.png\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"has-text-color wp-block-paragraph\" style=\"color:rgb(0, 0, 0)\">A Compose Action is used to create the folder name<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/06\/image-25-1024x253.png\" alt=\"\"\/><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code>toUpper(triggerOutputs()?&#91;'body\/eddev_customerrequestsid'])<\/code><\/pre>\n\n\n\n<p class=\"has-text-color wp-block-paragraph\" style=\"color:rgb(0, 0, 0)\">A Create Folder Action in SharePoint Is then executed. The site will be the the one from above, the library will be the library configured above. The folder path will be the output of the compose. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/06\/image-26-1024x393.png\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"has-text-color wp-block-paragraph\" style=\"color:rgb(0, 0, 0)\">The Next step will be to use Get the GUID of the Dataverse linkage created earlier. The relativeurl and name can be gathered from step 8 of setting up the SharePoint Connector<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/06\/image-27-1024x732.png\" alt=\"\"\/><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code>relativeurl eq 'PurchaseRequest' and name eq 'Purchase Request'<\/code><\/pre>\n\n\n\n<p class=\"has-text-color wp-block-paragraph\" style=\"color:rgb(0, 0, 0)\">Then adding a record into the Document Location Dataverse Table<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/06\/image-28-652x1024.png\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"has-text-color wp-block-paragraph\" style=\"color:rgb(0, 0, 0)\">The Parent Site will be the output of the list rows from above. Use the first expression to avoid a loop. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>first(outputs('List_rows')?&#91;'body\/value'])?&#91;'sharepointdocumentlocationid']<\/code><\/pre>\n\n\n\n<p class=\"has-text-color wp-block-paragraph\" style=\"color:rgb(0, 0, 0)\">The Regariding Customer Requests will be the ID of the trigger. To properly set this, you will need to get the entity set name. Use the code below to get the name. Replace the ORGID with your ORGID. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>https:&#47;&#47;ORGID.crm9.dynamics.com\/api\/data\/v9.1\/EntityDefinitions(LogicalName='TABLELOGICALNAME')?%24select=EntitySetName<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>2\/20\/2023 The Why When integrating Dataverse and SharePoint, it&#8217;s important to segregate documents from the default site. This helps ensure that only authorized users have access to the document libraries. By keeping the libraries separate, you can maintain better control over the documents and their distribution. The How Prior to using this guide the Default [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":233,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[25,4,26],"class_list":["post-365","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-model-driven-app","tag-dataverse","tag-mda","tag-sharepoint","entry","has-media"],"jetpack_featured_media_url":"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/06\/cover-4-scaled.jpg","_links":{"self":[{"href":"https:\/\/automatethemundane.com\/index.php\/wp-json\/wp\/v2\/posts\/365","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/automatethemundane.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/automatethemundane.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/automatethemundane.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/automatethemundane.com\/index.php\/wp-json\/wp\/v2\/comments?post=365"}],"version-history":[{"count":2,"href":"https:\/\/automatethemundane.com\/index.php\/wp-json\/wp\/v2\/posts\/365\/revisions"}],"predecessor-version":[{"id":501,"href":"https:\/\/automatethemundane.com\/index.php\/wp-json\/wp\/v2\/posts\/365\/revisions\/501"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/automatethemundane.com\/index.php\/wp-json\/wp\/v2\/media\/233"}],"wp:attachment":[{"href":"https:\/\/automatethemundane.com\/index.php\/wp-json\/wp\/v2\/media?parent=365"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/automatethemundane.com\/index.php\/wp-json\/wp\/v2\/categories?post=365"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/automatethemundane.com\/index.php\/wp-json\/wp\/v2\/tags?post=365"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}