Skip to main content

Notifications

Microsoft Dynamics 365 | Integration, Dataverse...
Unanswered

How to call an API via Code Activity Plugin on Microsoft Dynamics 365 Version 1612 (9.0.2.3034) (DB 9.0.2.3034) on-premises.

Posted on by 185

Hi all,

I'm working on a CodeActivity for Microsoft Dynamics 365 Version 1612 (9.0.2.3034) (DB 9.0.2.3034) on-premises.
I am trying to call an API but It gives an "Unable to connect to the remote server" error. The code I wrote for that works fine in a console application, but it fails in the plugin. The code looks like the following:


string URL = "xxxxxx.xxxx.it/.../xxx
System.Net.WebClient webClient = new System.Net.WebClient();
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
webClient.Headers.Add("Authorization", "Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
var result = webClient.DownloadString(URL);

Can you guys help me?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans