0

I'm new to custom workflow activities in Dynamics CRM 2016. I'm trying to download an image from url in the code below, the workflow is deployed in Dynamics crm online 2016. When I try to debug in visual studio the Plugin Registration Tool crashes without showing any errors at this line:

byte[] imageBytes = client.DownloadData(imageUrl); 

Code:

     private string ConvertImageToBase64(string imageUrl)
     {
            var base64String = string.Empty;                            
            using (WebClient client = new WebClient())
            {
                byte[] imageBytes = client.DownloadData(imageUrl);==== Fails here.
                base64String = Convert.ToBase64String(imageBytes);
            }

       return base64String;
     }
gee
  • 49
  • 1
  • 1
  • 5
  • Sorry I forgot to mention if I test the code in a console app it works fine without any problems, is it something to do with dynamics CRM online 2016? – gee Nov 28 '16 at 17:33
  • plugins and custom workflow activities have some limitations in CRM online because they don't run in full-trust. For example external urls should not be ip addresses, can you write the url structure of your image link? – Guido Preite Nov 28 '16 at 21:10
  • Example of my image url, last part is user's hashed email md5: http://www.gravatar.com/avatar/b7d4ee8dab1e37e871b2bbf7aa79dc34 – gee Nov 29 '16 at 07:45
  • You did you find the underlying error message. – James Wood Dec 02 '16 at 09:16

0 Answers0