I am a C# newbie and trying to use the example in the below link.
The problem is, it is asking for a reference and I can't seems to find it under
Microsoft.Exchange.WebServices
or any of the sub references under that, eventhough article pointing it to be part of the Exchange webservices.
Error occurs under the below line. It says something about a missing directive.
ConvertIdType request = new ConvertIdType();
Below is my code:
using System,
using Microsoft.Exchange.Webservices;
ConvertIdType request = new ConvertIdType();//error on this line.
ExchangeServiceBinding esb = new ExchangeServiceBinding();// same error on this liine too
exchange = new ExchangeService(ExchangeVersion.Exchange2010_SP1); //this line works fine.
What am I doing wrong here?
Thank you for your answers/pointers
UPDATE:: Thank you all for trying to answer my question. Sorry for not getting back earlier as I seem to have moved from that approach and continued without the requirement of this piece of code. It's been more than a year and I can't remember what was my ultimate goal in this.
In your example you have posted both code for the EWS Managed API library and the EWS WSDL proxy. ConverItType is a class from the WSDL proxy unless you have a need to write code using the WSDL proxy i would suggest you stick to using the EWS Managed API which will make you life a lot easier. Your code for the EWS Managed API should look like
using System,
using Microsoft.Exchange.Webservices.Data;
ExchangeService exchange= new ExchangeService(ExchangeVersion.Exchange2007_SP1);
exchange.Credentials = new WebCredentials("user1@contoso.com", "password ");
exchange.AutodiscoverUrl("user1@contoso.com");;
then whatever you want to do eg if you want to convert and Id then use the sample from https://learn.microsoft.com/en-us/previous-versions/office/developer/exchange-server-2010/gg274397(v%3Dexchg.80)