I am using Aspose.email for .NET 19.7 version
My code is about migration of contacts from one office 365 client to another client.
given below is the code I used to
: Listing all the contact Folders from the source client
: searching the folder on destination client
:if found then create contact on destination from the source
: otherwise create a contact folder and then create contact in it
The code worked fine with Aspose18.12 version but is not working in Aspose 19.7
I had to change the version to implement some of the new features of it.
Error Occurred: Cannot create a contact in a non contact folder
Please help me in sorting out the issue
try
{
Aspose.Email.PersonalInfo.Contact[] contacts = SourceClient.GetContacts(sourceFolder.Uri);
int contactcount = 0;
string folderUri;
DestClient.FolderExists(DestClient.MailboxInfo.ContactsUri, foldername, out temp);
if (temp == null)
folderUri = DestClient.CreateFolder(DestClient.MailboxInfo.ContactsUri, foldername, ExchangeFolderType.Contact).Uri;
else
folderUri = temp.Uri;
try
{
foreach (Aspose.Email.PersonalInfo.Contact contact in contacts)
{
MessageBox.Show(contact.DisplayName);
string ContactUri = DestClient.CreateContact(folderUri, contact);
DestClient.ListContacts(folderUri);
contactcount++;
}
}
catch (Exception ex)
{
MessageBox.Show("Error in creation of contact on existing folder" + Environment.NewLine + ex.Message);
}
}
catch(Exception ex)
{
MessageBox.Show("Error while migrating Contact " + ex.Message);
}