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

Free Support Forum - aspose.com

FetchContact Method Has Been Deprecated. How to Move to FetchItem?

Hi, how to use FetchItem to replace FetchContact?

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


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

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

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


it is the EWS Client:

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

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

Documents: Fetch Contact using Id
API Reference: IEWSClient Interface

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