Please run the following code using a contact that has a photo set. Note that the Data property is an empty byte array instead of containing the bytes of the photo.
using Aspose.Email;
using Aspose.Email.Clients.Exchange.WebService;
using System.Linq;
namespace ConsoleApp2
{
internal static class MainEntryPoint
{
private static readonly string _exchangeMailboxUri = “”; // <-- put your own URI here.
private static readonly string _firstMailboxAccountName = “”; // <-- put your own account name here.
private static readonly string _firstMailboxPassword = “”; // <-- put your own password here.
private static readonly string _secondMailboxSmtpEmailAddress = “”; // <-- put your own email address here.
internal static void Main(string[] args)
{
var lic = new License();
lic.SetLicense("Aspose.Total.lic");
var creds = new System.Net.NetworkCredential(_firstMailboxAccountName, _firstMailboxPassword);
using (IEWSClient client = EWSClient.GetEWSClient(_exchangeMailboxUri, creds))
{
var otherMB = client.GetMailboxInfo(_secondMailboxSmtpEmailAddress);
var contactInfo = client.ListMessages(otherMB.ContactsUri).First();
var mapiContact = client.FetchContact(contactInfo.UniqueUri);
byte[] photoData = mapiContact.Photo.Data; // zero bytes (should have bytes of attached photo file).
}
}
}
}