<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Andrew Robilliard</title>
    <description>The latest articles on DEV Community by Andrew Robilliard (@alrobilliard).</description>
    <link>https://dev.to/alrobilliard</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F67594%2F5ef01d73-9122-4c6f-82fb-366298256c44.png</url>
      <title>DEV Community: Andrew Robilliard</title>
      <link>https://dev.to/alrobilliard</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/alrobilliard"/>
    <language>en</language>
    <item>
      <title>Displaying SharePoint Documents in a D365 CE Form</title>
      <dc:creator>Andrew Robilliard</dc:creator>
      <pubDate>Tue, 17 Nov 2020 03:52:45 +0000</pubDate>
      <link>https://dev.to/alrobilliard/displaying-sharepoint-documents-in-a-d365-ce-form-3dcj</link>
      <guid>https://dev.to/alrobilliard/displaying-sharepoint-documents-in-a-d365-ce-form-3dcj</guid>
      <description>&lt;p&gt;Displaying SharePoint documents for an entity in Dynamics 365 CRM/CE has been a common requirement for a long time. For many years, the go-to fix was using an embedded IFrame on the form, pointed at the document relationship. However, this was always unsupported and was sure to break at some point...&lt;/p&gt;

&lt;p&gt;It turns out it finally did. If you follow along with the original approach, seen &lt;a href="https://jlattimer.blogspot.com/2017/01/show-sharepoint-documents-on-main-form.html" rel="noopener noreferrer"&gt;here&lt;/a&gt; on Jason Lattimer's blog, you'll find that the 'Upload' functionality now breaks if your organization has transitioned to the Unified Interface.&lt;/p&gt;

&lt;h2&gt;
  
  
  The New Approach
&lt;/h2&gt;

&lt;p&gt;It turns out, Microsoft has finally introduced a way to add this functionality out of the box. However, unless I've missed something, they haven't really talked about it anywhere. Hopefully, that's where this blog post comes in.&lt;/p&gt;

&lt;h2&gt;
  
  
  Steps
&lt;/h2&gt;

&lt;p&gt;Before starting, it is important to note that this only works on D365 CE online instances that have transitioned to the Unified Interface.&lt;/p&gt;

&lt;p&gt;I also assume that you have already set up Sharepoint Document management for the entity in question.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Navigate to &lt;a href="https://make.powerapps.com" rel="noopener noreferrer"&gt;https://make.powerapps.com&lt;/a&gt;, and open the entity form that you want to add documents to.&lt;/li&gt;
&lt;li&gt;Add a subgrid of 'related records' only, pointing at entity type 'Documents (Regarding)'
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fy1tl8oeugte7enyp7fcd.png" alt="Alt Text" width="800" height="759"&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Important note: this subgrid can only be added using the &lt;strong&gt;new&lt;/strong&gt; form editor. The 'Documents' entity will not be available in the legacy version.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After adding the subgrid, save and publish your form, and open it in the Unified Interface.&lt;/p&gt;

&lt;p&gt;You should now see a new Documents sub-grid, with the same contents as under the --&amp;gt; Regarding --&amp;gt; Documents tab.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fmsstfoh20bu4xhi28l6c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fmsstfoh20bu4xhi28l6c.png" alt="Alt Text" width="800" height="133"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Happy documenting! ✍&lt;/p&gt;

</description>
      <category>dynamics365</category>
      <category>powerplatform</category>
      <category>sharepoint</category>
    </item>
    <item>
      <title>Deploying .NET Core to Heroku</title>
      <dc:creator>Andrew Robilliard</dc:creator>
      <pubDate>Mon, 31 Aug 2020 05:04:55 +0000</pubDate>
      <link>https://dev.to/alrobilliard/deploying-net-core-to-heroku-1lfe</link>
      <guid>https://dev.to/alrobilliard/deploying-net-core-to-heroku-1lfe</guid>
      <description>&lt;p&gt;I've always loved coding in C#. Equally, I love using Heroku to host personal projects - they have a nice UI, and &lt;a href="https://www.heroku.com/pricing" rel="noopener noreferrer"&gt;a free tier!&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;However, there are a few limitations. Notably, .NET Core is not supported out of the box 😢. We can fix that!&lt;/p&gt;

&lt;h2&gt;
  
  
  The Fix
&lt;/h2&gt;

&lt;p&gt;While Heroku isn't able to run C# code directly, &lt;a href="https://www.heroku.com/deploy-with-docker" rel="noopener noreferrer"&gt;they do have support for Docker containers&lt;/a&gt;. With that our solution is clear - dockerize all the things!&lt;/p&gt;

&lt;h2&gt;
  
  
  Deploying a .NET Core App to Docker
&lt;/h2&gt;

&lt;p&gt;The following is not meant to be a .NET Core course, but you might pick up some basics on navigating the base files if you're a beginner. What we will cover:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Creating a new .NET Core MVC project from the command-line&lt;/li&gt;
&lt;li&gt;Modifying the base files to be Heroku &amp;amp; Docker compatible&lt;/li&gt;
&lt;li&gt;Configuring a new Heroku app&lt;/li&gt;
&lt;li&gt;Deploy our app to Heroku 🚀&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  1. Getting Started
&lt;/h3&gt;

&lt;p&gt;Before we get into changing some code, we need to get our foundation components in order. Before continuing, you should have:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;.NET Core installed on your device

&lt;ul&gt;
&lt;li&gt;I'm using v3.1 for this tutorial, which can be found &lt;a href="https://dotnet.microsoft.com/download/dotnet-core/3.1" rel="noopener noreferrer"&gt;here&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Docker installed on your device

&lt;ul&gt;
&lt;li&gt;You can follow the steps &lt;a href="https://docs.docker.com/get-docker/" rel="noopener noreferrer"&gt;here&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;A Heroku account! - &lt;a href="https://signup.heroku.com/" rel="noopener noreferrer"&gt;https://signup.heroku.com/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Install the &lt;a href="https://devcenter.heroku.com/articles/heroku-cli" rel="noopener noreferrer"&gt;Heroku CLI&lt;/a&gt;, which allows us to communicate with the Container Registry.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;With those out of the way, we're ready to go.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Creating a New .NET Core App
&lt;/h3&gt;

&lt;p&gt;First off, we need to create our new .NET Core app. I'll be following the steps for setting up a basic .NET Core MVC project, which can be found &lt;a href="https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-mvc-app/start-mvc?view=aspnetcore-3.1&amp;amp;tabs=visual-studio" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Setting Up a New Dockerfile
&lt;/h3&gt;

&lt;p&gt;The dockerfile required is pretty basic, with nothing too complex happening.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="c"&gt;# Dockerfile&lt;/span&gt;

&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;mcr.microsoft.com/dotnet/core/sdk:3.1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;AS&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;build-env&lt;/span&gt;
&lt;span class="k"&gt;WORKDIR&lt;/span&gt;&lt;span class="s"&gt; /app&lt;/span&gt;

&lt;span class="c"&gt;# Copy csproj and restore as distinct layers&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; *.csproj ./&lt;/span&gt;
&lt;span class="k"&gt;RUN &lt;/span&gt;dotnet restore

&lt;span class="c"&gt;# Copy everything else and build&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; . .&lt;/span&gt;
&lt;span class="k"&gt;RUN &lt;/span&gt;dotnet publish &lt;span class="nt"&gt;-c&lt;/span&gt; Release &lt;span class="nt"&gt;-o&lt;/span&gt; out

&lt;span class="c"&gt;# Build runtime image&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="s"&gt; mcr.microsoft.com/dotnet/core/aspnet:3.1&lt;/span&gt;
&lt;span class="k"&gt;WORKDIR&lt;/span&gt;&lt;span class="s"&gt; /app&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; --from=build-env /app/out .&lt;/span&gt;

&lt;span class="c"&gt;# Run the app on container startup&lt;/span&gt;
&lt;span class="c"&gt;# Use your project name for the second parameter&lt;/span&gt;
&lt;span class="c"&gt;# e.g. MyProject.dll&lt;/span&gt;
&lt;span class="k"&gt;ENTRYPOINT&lt;/span&gt;&lt;span class="s"&gt; [ "dotnet", "HerokuApp.dll" ]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Additionally, you should probably setup a .dockerignore file to keep your image size down.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="c"&gt;# .dockerignore&lt;/span&gt;

bin/
obj/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you want to test out your container, you can run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker build &lt;span class="nt"&gt;-t&lt;/span&gt; YourAppName &lt;span class="nb"&gt;.&lt;/span&gt;

&lt;span class="c"&gt;# The name variable (abc) is simply used to refer to the &lt;/span&gt;
&lt;span class="c"&gt;# container later when we want to close everything down.&lt;/span&gt;
docker run &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; 8080:80 &lt;span class="nt"&gt;--name&lt;/span&gt; abc YourAppName
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Navigate to &lt;a href="http://localhost:8080" rel="noopener noreferrer"&gt;http://localhost:8080&lt;/a&gt; and you should see your app running.&lt;/p&gt;

&lt;p&gt;All looking okay? Great! Lets shutdown the container locally. We don't need it running here if it's about to be up on the internet!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;--force&lt;/span&gt; abc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  4. Configuring a New App in Heroku
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Sign into Heroku, and create a new app from your personal dashboard at &lt;a href="https://dashboard.heroku.com/apps" rel="noopener noreferrer"&gt;https://dashboard.heroku.com/apps&lt;/a&gt;

&lt;ul&gt;
&lt;li&gt;You'll need to provide an app name, and deployment region&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Heroku will then display the various deployment options. We're going to be using &lt;strong&gt;Container Registry&lt;/strong&gt;
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F5npszhxskx1snumvvc0b.png" alt="Heroku Deployment Options" width="800" height="78"&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  5. Releasing to Heroku 🚀
&lt;/h3&gt;

&lt;p&gt;Last but not least, let's get it online.&lt;/p&gt;

&lt;p&gt;1. Using the command-line, login to the Heroku container registry&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;heroku container:login
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2. If you didn't above, make sure you build your docker &lt;br&gt;
container!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker build &lt;span class="nt"&gt;-t&lt;/span&gt; YourAppName &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3. Push your newly built container up to Heroku&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# 'YourAppName' should be the name of the app you &lt;/span&gt;
&lt;span class="c"&gt;# configured in Heroku in step 4.&lt;/span&gt;
heroku container:push &lt;span class="nt"&gt;-a&lt;/span&gt; YourAppName web
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;4. Finally, release!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;heroku container:release &lt;span class="nt"&gt;-a&lt;/span&gt; YourAppName web
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, if you just navigate to &lt;a href="https://your-app-name.herokuapp.com" rel="noopener noreferrer"&gt;https://your-app-name.herokuapp.com&lt;/a&gt;, you should see the base app. Wait... that didn't work! What happend?!&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fherstg4eltqx335au7ts.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fherstg4eltqx335au7ts.png" alt="Alt Text" width="800" height="366"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Take a look at the heroku logs&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;heroku logs &lt;span class="nt"&gt;--tail&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Within the scary looking logs, you'll see that .NET Core failed to start 'Kestrel', which is the web server for .NET Core. This means our app wasn't able to launch 😢.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fg2uoy445ehg52ohblcl4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fg2uoy445ehg52ohblcl4.png" alt="Alt Text" width="800" height="77"&gt;&lt;/a&gt;&lt;br&gt;
If you remember when we started our docker container locally back when we configure it, one of the parameters we passed was a port. When Heroku gives us a port to use, our app needs to know about it!&lt;/p&gt;

&lt;p&gt;Modify the end of the Dockerfile to be&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="c"&gt;# Dockerfile&lt;/span&gt;

&lt;span class="c"&gt;# ...&lt;/span&gt;

&lt;span class="c"&gt;# ENTRYPOINT [ "dotnet", "HerokuApp.dll" ]&lt;/span&gt;
&lt;span class="c"&gt;# Use the following instead for Heroku&lt;/span&gt;
&lt;span class="k"&gt;CMD&lt;/span&gt;&lt;span class="s"&gt; ASPNETCORE_URLS=http://*:$PORT dotnet HerokuApp.dll&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This allows the our container to use the Heroku-provided port on startup.&lt;/p&gt;

&lt;p&gt;Re-deploy everything to Heroku:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Build docker image&lt;/li&gt;
&lt;li&gt;Do a heroku container:push&lt;/li&gt;
&lt;li&gt;Do a heroku container:release&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;And voila - your very own .NET Core app hosted on the web.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;I hope the above tutorial is helpful, and allows some newbies to get started on their own .NET Core side projects.&lt;/p&gt;

&lt;p&gt;If anyone reading has some extra tips, or a better approach, please leave a comment below!&lt;/p&gt;

&lt;p&gt;Thanks for reading 👋 &lt;/p&gt;

</description>
      <category>dotnet</category>
      <category>heroku</category>
      <category>docker</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
