We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

FetchContact deprecated. How to move to FetchItem

Hi, how to use FetchItem to replace FetchContact?

Aspose.Email.Mapi.MapiContact currContact = service.FetchContact(msgUri);

to

Aspose.Email.Mapi.MapiContact currContact = service.FetchItem(msgUri);

It doesn’t work, perhaps because I need a cast?

@albertose,
Thank you for posting the query. Could you please clarify, what is service in your code snippet?

Hi,

it is the EWS Client:

service = EWSClient.GetEWSClient(serviceUrl, username, password);

@albertose,
Thank you for the additional information. Please try using the GetContact method instead.

Documents: Fetch Contact using Id
API Reference: IEWSClient Interface

@albertose,
If you need to get a MapiContact object, you can do it like this:

var fetchedContact = (MapiContact)service.FetchItem(msgUri).ToMapiMessageItem();

Documents: Using the FetchItem method to fetch a message