Aspose.Email 6.9--CreateContact issue

Hello.



we are having problem with create contact with Exchange server.



the problem is following

we create client = EWSClient.GetEWSClient

with application credentials which has access to users email.



but when we do client.CreateContac(outlookContact), it create contact not for the specific email but for the appictaion username.



is there way to specify the email account you the contact to be created for.



other work around I found is this

client.MoveItem(itemUri, contactsUrl);

but it throws an error message “Item move failed”.



Please advise

Hi Gagik,

Thank you for writing to Aspose Support team.

We have looked into your code sample but were not able to compile it due to the missing dependencies. We have, then, tried to generate a sample contact on Office365 test account that didn’t raise any such issue as you have mentioned. Could you please try it at your end and share your feedback with us? Also, you can login to the Office 365 portal to have a look at the generated contact for your reference.

Sample Code:

using (IEWSClient client = EWSClient.GetEWSClient(“https://outlook.office365.com/ews/exchange.asmx”, "asposetest@asposedev.onmicrosoft.com", “aspose@123”))

{

Aspose.Email.Mail.Contact contact = new Aspose.Email.Mail.Contact();

contact.EmailAddresses.Add(new Aspose.Email.Mail.EmailAddress() { Address = "mickey.mouse@disney.com", Prefered = true });

contact.PhoneNumbers.Add(new Aspose.Email.Mail.PhoneNumber() { Number = “+33621428165”, Prefered = true });

contact.DisplayName = “Mickey Mouse”;

contact.CustomerId = “VITOL customer Id”;

contact.Account = “VITOL AccountId”;

contact.JobTitle = “Actor”;

// Create the contact on the Exchange server

string contactId = client.CreateContact(contact);

}

Hi Kashif

your code creates contact for "asposetest@asposedev.onmicrosoft.com" right.

I don’t have problem with that, the problem is following.
lets assume you create Client for exchange user USERID(which has access to 10 mailboxes) now I want to create contact for any of those 10 mailboxes whichever was passed to me. How do I do it?
simply doing client.createcontact is going to create the contact for the userID mailbox.

This code attached does that.

basically I create the contact for UserID then

I get contacts URL for specific email and then I move the contact from UserId to that specific email contact.



but moveitem those an error which I cached in catch block.

see attachment.





Thanks a lot

Hi Gagik,

Thank you for providing more detail. You may please use impersonation as described here to access other user accounts from an account having impersonation rights. Please give it a try and share the feedback. Following is the sample code for accessing other user accounts and performing operations like adding message:

IEWSClient client1 = EWSClient.GetEWSClient("https://outlook.office365.com/ews/exchange.asmx", "testUser1", "pwd", "domain");
IEWSClient client2 = EWSClient.GetEWSClient("https://outlook.office365.com/ews/exchange.asmx", "testUser2", "pwd", "domain");
{
    string folder = "Drafts";

    try
    {
        foreach (ExchangeMessageInfo messageInfo in client1.ListMessages(folder))
            client1.DeleteMessage(messageInfo.UniqueUri);
        string subj1 = string.Format("NETWORKNET_33354 {0} {1}", "User", "User1");
        client1.AppendMessage(folder, new MailMessage("User1@exchange.conholdate.local", "To@Aspose.com", subj1, ""));
        foreach (ExchangeMessageInfo messageInfo in client2.ListMessages(folder))
            client2.DeleteMessage(messageInfo.UniqueUri);
        string subj2 = string.Format("NETWORKNET_33354 {0} {1}", "User", "User2");
        client2.AppendMessage(folder, new MailMessage("User2@exchange.conholdate.local", "To@aspose.com", subj2, ""));
        ExchangeMessageInfoCollection messInfoColl = client1.ListMessages(folder);
        client1.ImpersonateUser(ItemChoice.PrimarySmtpAddress, "User2@exchange.conholdate.local");
        ExchangeMessageInfoCollection messInfoColl1 = client1.ListMessages(folder);
        client1.ResetImpersonation();
        ExchangeMessageInfoCollection messInfoColl2 = client1.ListMessages(folder);
    }
    finally
    {
        try
        {
            foreach (ExchangeMessageInfo messageInfo in client1.ListMessages(folder))
                client1.DeleteMessage(messageInfo.UniqueUri);
            foreach (ExchangeMessageInfo messageInfo in client2.ListMessages(folder))
                client2.DeleteMessage(messageInfo.UniqueUri);
        }
        catch { }
    }
}

Hi Kashif

Thanks for your response, but I don’t think it resolves my problem.
(we use only application login to contact Exchange service and that login has access to all the emails.)
Can you please tell me why
client.MoveItem(itemUri, contactsUrl);
throws an error “Item move failed” even though the Item is moved successfully?

Hi Kashim

Thanks for your response, but it does not resolve my problem.
we only use application logging to access Exchange webservice and that log in has access to all the mailboxes. so we should be able to create contact for given email address using application login.

this was working perfectly until we upgraded to the latest version.

Can you please tell me why
client.MoveItem(itemUri, contactsUrl);
throws error “Item move failed” even though the item moved successfully.

Thanks

Hi Gagik,


Thank you for providing additional information. This issue is re-produced where MoveItem() raises exception while moving item to some other user account. It is logged under Id: EMAILNET-38606 for further investigation by the product team and you will be automatically notified once any update is received in this regard.

Thanks a lot Kashif.

You are welcome.

Hello Kashim

Can you please tell when we can expect solution for this issue?

Thank you

Hi,


The issue has been logged too recently and is pending for analysis by our Product team. We’ll update you here once there is some information or a fix version available in this regard.

Good morning Kashim.

Do you know approximately how long this fix will take?

We have a release soon and want to see if we can include this in to it.

Thanks

Hi,


We are sorry for the inconvenience you are facing.

We have checked the status of this issue and, am sorry to share that, there is no ETA available for it. We have requested our Product team to share if it will be part of the upcoming release of the API or not? We’ll update you here as soon as there is some information available in this regard.

Hi Kashif
it has been a month since last status update.
Any news for me?

Thanks

Hi Gagik,


We are glad to inform that this issue is resolved and will be part of our upcoming release. You will be automatically notified once any update is received or new version is available online for download.

Hi Kashif

Do you know the release date, that will include this fix?

Thanks

Hi Gagik,


We are currently in process of revamping of Aspose.Email for .NET to improved namespace structure and it may take a little extra time for releasing Aspose.Email for .NET 17.3.0. The release is expected to be available for download early next month. We’ll update you here once the fix version is available for download.

The issues you have found earlier (filed as EMAILNET-38606) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Hi Kashif

I have downloaded the latest version and it looks like the whole namespace has changed.

where I can find the documentations for the latest version? the developers guide on your page does not reflect new version.

Thanks