{"id":3900,"date":"2020-08-16T02:30:10","date_gmt":"2020-08-16T02:30:10","guid":{"rendered":"https:\/\/himbap.com\/blog\/?p=3900"},"modified":"2020-08-24T08:18:32","modified_gmt":"2020-08-24T08:18:32","slug":"getting-share-point-document-url-in-dynamics-365-ce","status":"publish","type":"post","link":"https:\/\/himbap.com\/blog\/?p=3900","title":{"rendered":"Getting Share Point Document URL in Dynamics 365 CE"},"content":{"rendered":"<p><strong>Introduction<\/strong><br \/>\nSometime we required to get full path of the image which we have uploaded to Share Point document for specific entity. In this article I am going to demonstrate how Microsoft Flow can be used to implement this requirement. Feel free to comment if there is another easy of doing this.<br \/>\n<strong><br \/>\nThis article is assuming you have basic understanding of Dynamics 365 CE Share Point integration and Flow as well as Share Point integration is already configured.Keep in mind this is for the demo purpose but you can change it accordingly to your requirement.<\/strong><\/p>\n<p><strong>Details<\/strong><\/p>\n<p>Let&#8217;s add a string field in the Contact entity where we are going to store URL, our field look like below<br \/>\n<a href=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-3901 aligncenter\" src=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl-300x216.jpg\" alt=\"Imageurl\" width=\"300\" height=\"216\" srcset=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl-300x216.jpg 300w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl-624x449.jpg 624w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl.jpg 765w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Now Navigate to Flow and using Following steps:<\/p>\n<p>&gt; Click on New and select automatic flow having following trigger<\/p>\n<p><a href=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl1.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-3902 aligncenter\" src=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl1-300x190.jpg\" alt=\"Imageurl1\" width=\"300\" height=\"190\" srcset=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl1-300x190.jpg 300w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl1-624x395.jpg 624w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl1.jpg 871w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>&gt; Let&#8217;s name our flow as &#8220;Set Image URL For Contact&#8221; and set action properties like below:<br \/>\n<a href=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl3.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-3903 aligncenter\" src=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl3-300x124.png\" alt=\"Imageurl3\" width=\"300\" height=\"124\" srcset=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl3-300x124.png 300w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl3-624x257.png 624w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl3.png 859w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>&gt; Now let&#8217;s add some variable which we require for formatting URLs, Click on + New Step and search for variable and select Initialize Variable, In this variable we are going to set our Share Point Site URL.<br \/>\n<a href=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl4.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-3904 aligncenter\" src=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl4-300x92.png\" alt=\"Imageurl4\" width=\"300\" height=\"92\" srcset=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl4-300x92.png 300w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl4.png 614w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>&gt; Add another integer type variable, where we are going to store last index of &#8220;\/&#8221; in URL, it should look like following:<br \/>\n<a href=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl5.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-3905 aligncenter\" src=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl5-300x103.jpg\" alt=\"Imageurl5\" width=\"300\" height=\"103\" srcset=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl5-300x103.jpg 300w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl5.jpg 618w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>In above express I am using following formula<\/p>\n<p><strong>lastIndexOf(triggerBody()?[&#8216;{Path}&#8217;],&#8217;\/&#8217;)<\/strong><\/p>\n<p>&gt; Add another variable and call it Folder path, we will be setting this variable at later stage<br \/>\n<a href=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl6.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-3906 aligncenter\" src=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl6-300x99.jpg\" alt=\"Imageurl6\" width=\"300\" height=\"99\" srcset=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl6-300x99.jpg 300w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl6.jpg 619w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>&gt; We need other variable to store image extension like following to validate specific file extension you can use based on your requirement.<br \/>\n<a href=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl7.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-3907 aligncenter\" src=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl7-300x91.jpg\" alt=\"Imageurl7\" width=\"300\" height=\"91\" srcset=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl7-300x91.jpg 300w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl7.jpg 616w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>We are using following formula in above variable<\/p>\n<p><strong>last(split(triggerBody()?[&#8216;{FilenameWithExtension}&#8217;], &#8216;.&#8217;))<\/strong><\/p>\n<p>&gt; Add a condition and add condition to check folder and file extension like following<br \/>\n<a href=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl8.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-3908 aligncenter\" src=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl8-300x134.jpg\" alt=\"Imageurl8\" width=\"300\" height=\"134\" srcset=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl8-300x134.jpg 300w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl8-624x280.jpg 624w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl8.jpg 634w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>&gt; Now under yes, blow first we are going to set folder path, this step may vary based on your entity name ,<\/p>\n<p><a href=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl9.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-3909 aligncenter\" src=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl9-300x138.jpg\" alt=\"Imageurl9\" width=\"300\" height=\"138\" srcset=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl9-300x138.jpg 300w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl9.jpg 623w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>I am using following formula to set variable<br \/>\n<strong>substring(triggerBody()?[&#8216;{Path}&#8217;],8,sub(variables(&#8216;lastindex&#8217;),8))<\/strong><\/p>\n<p>Above 8 is count of entity +1 so for example cotnact\/ will be 8<\/p>\n<p>&gt; Next we need to query document location record based on the folder path, we can use Dataflex (Common Data Service current) connector. Select List records and set it&#8217;s property like following<\/p>\n<p><a href=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl10.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-3910 aligncenter\" src=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl10-300x211.jpg\" alt=\"Imageurl10\" width=\"300\" height=\"211\" srcset=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl10-300x211.jpg 300w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl10.jpg 607w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>In above we are going to query Document Locations record based on the Folder Path variable<\/p>\n<p>&gt; Finally add a Update action from Dataflex (Common Data Service current) connector and set it&#8217;s properties like following<\/p>\n<p><a href=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl11.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-3911 aligncenter\" src=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl11-300x171.png\" alt=\"Imageurl11\" width=\"300\" height=\"171\" srcset=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl11-300x171.png 300w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl11-624x356.png 624w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl11.png 651w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Apply to each loop will be automatically applied when we will set field returned from Document Location record step. Finally our flow should look like below<br \/>\n<a href=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl12.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-3912 aligncenter\" src=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl12-300x225.jpg\" alt=\"Imageurl12\" width=\"300\" height=\"225\" srcset=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl12-300x225.jpg 300w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl12-624x468.jpg 624w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/Imageurl12.jpg 686w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Finally try to upload image to your entity you should see image URL populated after some time<\/p>\n<p><a href=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/filename.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-3914 aligncenter\" src=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/filename-300x127.jpg\" alt=\"filename\" width=\"300\" height=\"127\" srcset=\"https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/filename-300x127.jpg 300w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/filename-624x265.jpg 624w, https:\/\/himbap.com\/blog\/wp-content\/uploads\/2020\/08\/filename.jpg 725w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><strong>Summary<\/strong><br \/>\nSo if you are need file name with extension or need path of the file you can use above Flow to store file name in CRM.<\/p>\n<p>Hope it will help someone!<br \/>\n<strong>Keep learning, Keep sharing !!<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Sometime we required to get full path of the image which we have uploaded to Share Point document for specific entity. In this article I am going to demonstrate how Microsoft Flow can be used to implement this requirement. Feel free to comment if there is another easy of doing this. This article is assuming you have basic understanding&#8230; <a href=\"https:\/\/himbap.com\/blog\/?p=3900\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":3231,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[21,402,522,593,728,14],"tags":[798,805,801,799,800,803,802,804],"_links":{"self":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3900"}],"collection":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3900"}],"version-history":[{"count":7,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3900\/revisions"}],"predecessor-version":[{"id":3927,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3900\/revisions\/3927"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/media\/3231"}],"wp:attachment":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3900"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3900"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3900"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}