Hi,
I am trying to develop a BP C# object that uses Exchange Web Services (EWS). I have written a working code in Visual Studio but I am struggling to make in work in Object Studio.
This is the code from Visual Studio:
using Microsoft.Exchange.WebServices.Data;
using System;
using System.Net;
namespace ConsoleApp
{
class Program
{
static void Main(string[] args)
{
ExchangeService service = new ExchangeService();
service.Credentials = new NetworkCredential("userid", "password");
service.Url = new Uri("https://outlook.office365.com/EWS/Exchange.asmx");
service.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.SmtpAddress, "userid");
Folder inbox = Folder.Bind(service, WellKnownFolderName.Inbox);
Console.WriteLine($"Unread email in inbox: {inbox.UnreadCount}");
Console.ReadLine();
}
}
}
My code stage in Object Studio looks like this:
I have copied the Microsoft.Exchange.WebServices DLL to C:\Program Files\Blue Prism Limited\Blue Prism Automate\, and added Microsoft.Exchange.WebServices.dll and System.Net.dll to External References and Microsoft.Exchange.WebServices.Data and System.Net to Namespace Imports.
I get the following errors:
Can anyone see what I am doing wrong? I realize that the code stage errors are syntax related, but I won't be able to fix those until the namespace error is resolved, which I have no clue how to fix.
Thank you very much in advance!
------------------------------
Christian Juhl
Business Controller
Danske Commodities
Europe/Copenhagen
------------------------------