Hi Michel,
IEWSClient client = GetAsposeEWSClient1();
MapiContact[] contacts = client.ListContacts(client.MailboxInfo.ContactsUri, ExchangeListContactsOptions.FetchAttachmentAndFullPhotoInformation);
Console.WriteLine(contacts[0].NameInfo.DisplayName);
Console.WriteLine(contacts[0].PersonalInfo.Notes);
contacts[0].Save(“BeforeContact.msg”, ContactSaveFormat.Msg);
contacts[0].NameInfo.DisplayName = “Changed Name”;
Thread.Sleep(10000);
client.UpdateContact(contacts[0]);
contacts = client.ListContacts(client.MailboxInfo.ContactsUri, ExchangeListContactsOptions.FetchAttachmentAndFullPhotoInformation);
Console.WriteLine(contacts[0].NameInfo.DisplayName);
contacts[0].Save(“AfterContact.msg”, ContactSaveFormat.Msg);
Hi Kashif,
Thanks for the quick reply.
–
IEWSClient client = GetAsposeEWSClient();
client.ImpersonateUser(ItemChoice.PrimarySmtpAddress, "BobK@contoso.com");
MapiContactCollection contacts = client.ResolveContact(“Doe”);
Console.WriteLine(contacts[0].NameInfo.DisplayName);
Console.WriteLine(contacts[0].PersonalInfo.Notes);
//contacts[0].Save(“BeforeContact.msg”, ContactSaveFormat.Msg);
client.UpdateContact(contacts[0]);
Thread.Sleep(2000);
contacts = client.ResolveContact(“Doe”);
Console.WriteLine(contacts[0].NameInfo.DisplayName);
Console.WriteLine(contacts[0].PersonalInfo.Notes);
//contacts[0].Save(“AfterContact.msg”, ContactSaveFormat.Msg);
client.ResetImpersonation();
Console.ReadLine();
----
The MapiContact.Save method throws the error “Parameter is not valid.” for me. The msg files attached have been exported from outlook before and after running the code.
Hi Michel,
Thank you for providing additional information.
With respect to the issue of saving the resolved contact from Exchange server, I was able to reproduce the same exception “Parameter is not valid” and have logged it as NETWORKNET-34568 in our issue tracking system. We’ll notify you here once the issue is resolved and there is some update available in this regard.
I would further like to share with you that the issue of contacts update after impersonation is under investigation and we will soon share our feedback with you. We appreciate your patience in this regard.
PS: The ListContacts method of IEWSClient has been marked as deprecatted. Please use the GetContacts method instead of this whereever required.
The issues you have found earlier (filed as NETWORKNET-34568) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.
Hi Kashif,
The "Parameter is not valid" error on save has indeed been fixed. Thanks.
Do you also have an update on the investigation of the actual issue where the picture and note of the contact are being corrupted after a contact.update() when I retrieve a contact using ResolveContact()? ResolveContact() is the only method I can use to retrieve a contact when using impersonation. GetContacts() and ListContacts() return nothing.
The 4.9.0 doesn't fix this yet.
Thanks in advance.
Hi Michael,
Hi Kashif,
I’m able to reproduce the problem with the demo Exchange Server 2010 SP1 VHD from Microsoft available at http://www.microsoft.com/en-us/download/details.aspx?id=5002
running on Windows Server 2008 R2 Eneterprise Edition.
I’ve attached a dump of the installed programs and hotfixes.
I hope this will help to pinpoint the problem.
Hi Michael,
Please spare us a little time for setting up the environment at our end and test this issue further. We’ll soon share our feedback with you in this regard.
Hi Michael,
Please accept our apology for getting back to you on this a little late.
We have set up the environment and tested this issue. Eventually, I was able to reproduce the issue and found that ResolveContact is not fetching the Photo contact (you can test it by saving the retrieved contact). The issue has been logged as EMAILNET-34681 in our issue tracking system for further investigation by our development team. We’ll notify you here once there is some information available.
The issues you have found earlier (filed as EMAILNET-34681) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.
Hello kashif,
I did use the latest DLL but it didn’t solve my errors!
Please look at the first post of this thread:
When I have an existing contact in Outlook and use the “UpdateContact” method to alter some details the contact’s picture DISAPPEARS. Also, when the contact’s note field had a value, the existing note will be CORRUPTED and will show the HTML to the user.
When i use the code mentioned in a earlier post, the fields are still getting corrupted.
I want to clearify that the 2 fields (Photo and Notes field) are NOT changed by my code. I only change some fields like name, email address etc.
So when i do update an EXISTING personcard ,the 2 fields are corrupted afterwards
(Screenshots of the corrupted fields in earlier post :EWSClient.UpdateContact -> Picture disappears and note field gets corrupted)
Hi Michel,
Thank you for sharing your feedback.
I have investigated this issue with the latest version of Aspose.Email for .NET 5.1.0 and following are my findings:
- I have used the following code sample to resolve and update the contact and no photo information is lost. Could you please give it a try and let us know your feedback.
Code:
IEWSClient client = GetAsposeEWSClient1();
Contact[] contacts = client.ResolveContacts("Contact Name", ExchangeListContactsOptions.FetchAttachmentAndFullPhotoInformation);
contacts[0].DisplayName = "Changed Name";
client.UpdateContact(contacts[0]);
- Regarding the Contact Notes issue, I have tested it from Microsoft Outlook as well. If you edit a contact’s information from Outlook and save it, and then view the contact details in OWA, you will see that the contact’s Notes information is converted to HTML. Could you please check this at your end and let us know your feedback? We shall further looking into this for investigation at our end.
Hello,
I could test that code but what i mentioned in my earlier posts:I don’t update the photo with my code. So i upload a photo in Outlook and change the note field to an existing contact.
After that i run my code to update Contact Name, Email and telephone of that existing contactperson. I get my data from an another backend program.I don’t have photo information in the backend so i only want to change some data of that existing Contact Person. So when i do this, the photo and Note information are also altered to something else. Photo is gone and Notes field is changed to HTML code(So it looks like when i don’t synchronise the photo, the program thinks that there is no photo and that he must delete it in the contact?)
About the Note field:
When i change the note field in Outlook or OWA, it never changes to the HTML variant of it. It keeps showing me only the text. Only after change the contact card with my code, it changes to the HTML variant of it.
I hope i make myself clear?
Thanks in advance!
Hi Michel,
In order to avoid any confusion, weI have created an online account on Office 365 server with following credentials. You can now use this account and the attached sample Contact MSG file to give a try to the following code samples that we have used in our tests.
**Exchange Server URI:** https://outlook.office365.com/ews/exchange.asmx
**Username:** [UserOne@ASE1982.onmicrosoft.com](mailto:UserOne@ASE1982.onmicrosoft.com)
**Password:** Aspose1234
1. The attached Message file 1.msg
is an Outlook contact that is added to this Exchange server account
using the following code sample. This contact has Photo as well as Notes
information that you can verify by viewing in MS Outlook.
Sample Code:
static void CreateContactOn365()
{
IEWSClient client1 = EWSClient.GetEWSClient("https://outlook.office365.com/ews/exchange.asmx", "UserOne@ASE1982.onmicrosoft.com", "Aspose1234");
MapiMessage msg = MapiMessage.FromFile("1.msg");
MapiContact mapiContact = (MapiContact)msg.ToMapiMessageItem();
client1.CreateContact(mapiContact);
}
- This contact is downloaded, changes made to the contact name,
uploaded and again downloaded using the following code sample to verify
that Photo information is not lost and Notes are also not disturbed.
Please note the ResolveContacts method that uses the additional option
of ExchangeListContactsOptions.FetchAttachmentAndFullPhotoInformation which ensures to fetch complete contact information from server.
//This method will resolve the contact and fetch contact **with** photo information
static void ResolveContactWithPhotoFetchFrom365()
{
IEWSClient client = EWSClient.GetEWSClient("https://outlook.office365.com/ews/exchange.asmx", "UserOne@ASE1982.onmicrosoft.com", "Aspose1234");
Contact[] contacts = client.ResolveContacts("Sebastian", ExchangeListContactsOptions.FetchAttachmentAndFullPhotoInformation); //message is resolved and fetched with photo information
contacts[0].Save("ResolveContactWithPhoto.msg", ContactSaveFormat.Msg); //verify that the saved contact has photo
contacts[0].DisplayName = "Changed Sebestian"; //now when you change this information,
client.UpdateContact(contacts[0]); //and update it, basically you are updating a contact that has photo information
Thread.Sleep(5000);
//again fetch the same contact and verify that the photo has lost
contacts = client.ResolveContacts("Changed Sebastian", ExchangeListContactsOptions.FetchAttachmentAndFullPhotoInformation);
contacts[0].Save("Updated-ResolveContactWithoutPhoto.msg", ContactSaveFormat.Msg); //verify that the photo is still available.
}
- The same contact is fetched, updated for contact name, uploaded
and downloaded again to verify that the photo information is lost now. Please note the ResolveContacts method that doesn’t use the additional option of ExchangeListContactsOptions.FetchAttachmentAndFullPhotoInformation due to which the photo information is lost while resolving the contact information from the Exchange server. Please also note that the Notes information is still not disturbed.
//This method will resolve the contact and fetch contact **without** photo inforamtion
static void ResolveContactWithoutPhotoFetchFrom365()
{
IEWSClient client = EWSClient.GetEWSClient("https://outlook.office365.com/ews/exchange.asmx", "UserOne@ASE1982.onmicrosoft.com", "Aspose1234");
Contact[] contacts = client.ResolveContacts("Sebastian"); //message is resolved and fetched without photo information..so photo information is lost at this stage
contacts[0].Save("ResolveContactWithoutPhoto.msg", ContactSaveFormat.Msg); //you can verify here that the photo information is lost
contacts[0].DisplayName = "Changed Sebestian"; //now when you change this information,
client.UpdateContact(contacts[0]); //and update it, basically you are updating a contact that already doesn't have any photo information
Thread.Sleep(5000);
//again fetch the same contact and verify that the photo has lost
contacts = client.ResolveContacts("Changed Sebastian", ExchangeListContactsOptions.FetchAttachmentAndFullPhotoInformation);
contacts[0].Save("Updated - ResolveContactWithoutPhoto.msg", ContactSaveFormat.Msg); //verify that the photo is lost.
}
I would request you to please try these code samples by creating the attached
contact on the Exchange Server, and then trying the methods one by one.
Please share your feedback with us once your investigation is completed
in this regard.
Hello Muhammad,
Sorry for this late reaction!
i changed my code like the example you provided.
This solved my photo problem!!
The photo is not gone after updating my contact.
Thanks for that!
But… still my notes are changed to HTML.
In outlook, on a contact in Notes field i have the text :Hello
When i open the contact with the new code, and i look in Contacts[0].Notes, i see already the HTML.
After updating/save the contact , the field Notes in my outlook changed to HTML.
Please look at my 2 schreenshots, before and after. Looks like there must be an HTML encoded true/false property for Notes ??
Hope you can look in to that again?
Thanks in advance!
Hi Michel,
The issues you have found earlier (filed as EMAILNET-34735) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.