Use custom browser protocol to launch desktop applications from Dynamics 365


Recently we had a requirement to launch a .NET desktop application installed in the user’s machine from within Dynamics 365 and also pass parameters to it.

One of the ways of implementing is by using the Custom URL Protocol.

Modern browsers and operating systems allow us to implement a custom URL protocol and register an external application to handle it. So when a user clicks  on the link that uses that custom URL Protocol, the browser will open the application that is registered.

Check a few examples here

https://docs.microsoft.com/en-us/windows/uwp/launch-resume/launch-app-with-uri

So, let us start and register our Custom URL Protocol.

Below is the source code for creating a new key


var applicationPath = @"C:\MyParamApp\MyApp\bin\Debug\MyApp.exe";
var KeyTest = Registry.CurrentUser.OpenSubKey("Software", true).OpenSubKey("Classes", true);
RegistryKey key = KeyTest.CreateSubKey("OpenAppP");
key.SetValue("URL Protocol", "OpenAppP");
key.CreateSubKey(@"shell\open\command").SetValue("", "\"" + applicationPath + "\" \"%1\"");

Here OpenAppP is the protocol name and the application path that holds the path of application that we want to execute.

For key.CreateSubKey we have specified %1 for passing the parameter.

If we do not want to pass the parameter then we do not need to append it.

On running the above code, we can see the key added with the value specified

Below is the source code of our console application, basically it reads and writes the parameter in the output window.

Below is our Html page that we will call from within a button on a form from Dynamics 365 and which will open the MyApp.exe in turn.

Here we have published the page in Azure.

The html page on onload will retrieve the id query parameter and append it to the link for the custom protocol

OpenAppP:id

Back in CRM, we have a custom ribbon button named Open Console App added with the following definition.

Url Command Action and Crm Parameter in it to pass the id.

Clicking on the button

as expected, opens the alert along with opening the console app with the parameter passed to it.

Get more details

https://www.vdoo.com/blog/exploiting-custom-protocol-handlers-in-windows

Hope it helps..

 

Advertisements

Author: Nishant Rana

I love working in and sharing everything about Microsoft.NET technology !

2 thoughts on “Use custom browser protocol to launch desktop applications from Dynamics 365”

Please share your thoughts

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Welcome to the Blog & Website of Paul Andrew

Technical Leadership Centred Around the Microsoft Data Platform

Deriving Dynamics 365

Deriving Solutions and features on Power Platform/Dynamics 365

The CRM Ninja

Thoughts & musings from a Dynamics 365 Ninja!

CRM for You and Me

Customer Relationship Mgt App for the Professional

D CRM Explorer

Learn about Microsoft Dynamics CRM Power Platform customization and implementation and other cool stuffs

Stroke // Jonas Rapp

I know pre-stroke. I will improve who I was.

Power Melange

Power Melange By Shalinee

Clavin's Blog

Power Automate - Power Apps - SharePoint Online - Azure - Nintex - K2 - Artificial Intelligence

Sat Sangha Salon

An Inquiry in Being

The Indoencers

The Influencers & Influences of Indian Music

Monika Halan's blog

Hand's-free money management

D365 Demystified

A closer look at Microsoft Dynamics 365.

Microsoft Mate (msftmate) - Andrew Rogers

Experienced consultant primarily focused on Microsoft Dynamics 365 and the Power Platform

Knowhere365

Specific topics by Django Lohn on the whole Microsoft365 Stack

Manmit Rahevar's Blog

One Stop Destination for Microsoft Technology Solutions

MG

Naturally Curious

Brian Illand

Power Platform and Dynamics 365

Steve Mordue MVP

A Microsoft Business Applications MVP

Subwoofer 101

Bass defines your home theater

SQLTwins by Nakul Vachhrajani

SQL Server tips and experiences dedicated to my twin daughters.

Everything D365

Discovering Azure DevOps and D365 Business Applications

Tech Wizard

Lets do IT Spells

XRM Tricks (Power Platform & Dynamics CRM )

Power Platform & Dynamics CRM

CRM TIPS BY PRM

Mail to crmtipsbyprm@gmail.com for queries and suggestions

nijos.dev

Giving back to the community what I have learned

xrm CRM Dynamics

Dynamics CRM Technical & Functional Info

Dynamics 365 Blogs - Explained in unique way

Sometimes you need to look at things from different perspective.

CRM Keeper

Dynamics 365 Customer Engagement, CRM, Microsoft CRM, Dynamics CRM

EVOLVED365

Step into the world of a Dynamics 365 Consultant

Dianamics PCF Lady

Diana & Dynamics 365 & Power Platform

Sara Lagerquist

No Code Customization Concepts

innovativeaj

developer, designer, writer, fun loving, patriotic, humble and a sweet person inside out :) love and respect people who have a great sense of humor.

Temmy Wahyu Raharjo

dreaming to be a clean coder and TDD minded programmer.

%d bloggers like this: