I'm trying to fetch a list of tasks that may be in a mailbox but I'm having some problems trying to figure out how to do it. I have a bit of code that looks like this:
// Init EWS Client (credentials wiped for forum post)
const string uri = "https://192.168.4.66/EWS/Exchange.asmx";
var credentials = new NetworkCredential(***);
_ewsClient = EWSClient.GetEWSClient(uri, credentials);
// Get mailbox (wiped for forum post)
var mailbox = _ewsClient.GetMailboxInfo(***);
// List messages in Inbox folder (it is assumed that there is at least one message IPM.Note in Inbox folder)
var messages = _ewsClient.ListMessages(mailbox.InboxUri);
// List messages in Tasks folder (it is assumed that there is at least one task IPM.Task in Tasks folder)
var tasks = _ewsClient.ListMessages(mailbox.TasksUri);
// Try to fetch message from Inbox - OK
var m1 = _ewsClient.FetchMessage(messages.First().UniqueUri);
// Try to fetch task from Tasks folder - exception
var m2 = _ewsClient.FetchMessage(tasks.First().UniqueUri);
So - that makes an exception. Then I tried this:
// It is possible to fetch task using FetchTask method -
// but we need a way to convert ExchnageTask object (as well as Appointment) to MapiMessage - is it possible?
var t1 = _ewsClient.FetchTask(tasks.First().UniqueUri);
// convert ExchnageTask and Appointment to MapiMessage ?
I don't know how to now make this a MapiMessage at this point, I couldn't see any classes that might help facilitate that.
Can you help me out with this please?
// Init EWS Client (credentials wiped for forum post)
const string uri = "https://192.168.4.66/EWS/Exchange.asmx";
var credentials = new NetworkCredential(***);
_ewsClient = EWSClient.GetEWSClient(uri, credentials);
// Get mailbox (wiped for forum post)
var mailbox = _ewsClient.GetMailboxInfo(***);
// List messages in Inbox folder (it is assumed that there is at least one message IPM.Note in Inbox folder)
var messages = _ewsClient.ListMessages(mailbox.InboxUri);
// List messages in Tasks folder (it is assumed that there is at least one task IPM.Task in Tasks folder)
var tasks = _ewsClient.ListMessages(mailbox.TasksUri);
// Try to fetch message from Inbox - OK
var m1 = _ewsClient.FetchMessage(messages.First().UniqueUri);
// Try to fetch task from Tasks folder - exception
var m2 = _ewsClient.FetchMessage(tasks.First().UniqueUri);
So - that makes an exception. Then I tried this:
// It is possible to fetch task using FetchTask method -
// but we need a way to convert ExchnageTask object (as well as Appointment) to MapiMessage - is it possible?
var t1 = _ewsClient.FetchTask(tasks.First().UniqueUri);
// convert ExchnageTask and Appointment to MapiMessage ?
I don't know how to now make this a MapiMessage at this point, I couldn't see any classes that might help facilitate that.
Can you help me out with this please?