The Operation failed. When sending email / saving to SQL Database C#

Add-in Express™ Support Service
That's what is more important than anything else

The Operation failed. When sending email / saving to SQL Database C#
 
Jouke Rossum


Guest


Hi,

In our outlook add-in we have the functionality to save emails directly into a SQL Database. 1 of our customers are getting errors like below:

1. The Operation failed, when saving a sent email.
2. The clientoperation failed (translated from dutch), when saving a sent mail.
3. File is in use when trying to save an attachment.

These errors are not always showing up. I've developed the add-in so that when a user sents an email it's possible to save the email to the sql database. Therefore IF the email is sent, it goes from Outbox to Sent items. When it's added to sent items our add-in shows the form where the user can save the email.

In this process the errors are showing up.

I've got no clue why it happens, what is causing this or when it will occur.

Does anybody have a clue?

Thanks in advance.

Best regards,

Jouke van Rossum
Posted 22 Jan, 2016 07:48:28 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Jouke,

I can assume that your customer has an IMAP account in Outlook. We have faced many strange issues related to IMAP implementation, please check this. If it is the case, I would suggest that you create an IMAP account on your development machine, test and debug your code.
Posted 22 Jan, 2016 08:19:05 Top
Jouke Rossum


Guest


Thank you, Dmitry for your response.

Unfortunatly, this is not the case. The users have an Exchange Mail Account.
Posted 22 Jan, 2016 08:48:25 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Jouke,

Thank you for the additional information. What about the "Use Cached Exchange Mode" option, is it ON or OFF?
Posted 22 Jan, 2016 08:56:07 Top
Jouke Rossum


Guest


Hi Dmitry,

The System operator told me "Use Cached Exchange Mode" is turned off.
Posted 22 Jan, 2016 09:05:42 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Jouke,

Thanks. I think this may affect the issue. I would suggest that you debug your code with such Outlook account configuration. Probably you can implement a "wait a bit" approach, i.e. if your code catches an exception when accessing some properties of an email, then you can store its EntryID in a collection and execute the same code a bit later (of course, by getting the mail item by its EntryID), say after 1-2 seconds.
Posted 22 Jan, 2016 09:19:14 Top
Jouke Rossum


Guest


Hi Dmitry,

I'm using the caching mode on my test machines. While our customer does not.

Why is the caching mode causing these issues?

Best regards,

Jouke van Rossum
Posted 25 Jan, 2016 10:50:49 Top
Andrei Smolin


Add-in Express team


Posts: 18829
Joined: 2006-05-11
Hello Jouke,

When Caching Mode is Off, there's no data stored locally: to retrieve/save any portion of data (e.g.Subject, Body, etc.), Outlook must issue a server call. If such a call fails (e.g. due to network conditions), you get an exception.


Andrei Smolin
Add-in Express Team Leader
Posted 26 Jan, 2016 04:33:19 Top
Jouke Rossum


Guest


Hello Andrei,

Thank you for your explanation. In the case of our customer it is not possible due to server conditions that caching mode can be enabled for all users.

What is the best way to fix this issue without enabling the caching mode?

Best regards,

Jouke van Rossum
Posted 26 Jan, 2016 05:30:48 Top
Andrei Smolin


Add-in Express team


Posts: 18829
Joined: 2006-05-11
First, you need to reproduce the issue. Then you need to debug the code and find what to do (try/catch blocks?).


Andrei Smolin
Add-in Express Team Leader
Posted 26 Jan, 2016 05:50:21 Top