reset instance


First, sorry for my possibly bad English.

Im using the Microsoft.Office.Interop.Outlook.ApplicationClass.‘Microsoft.Office.Interop.Outlook, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c’ Dotnet to send emails from Navision (business central).

The problem is: my customer use the application from more than one Navision sessions, and then there is a conflict:

“changes made to the item were lost because of a reconnect with the server”

I need reset or close the app instance between calls, but I dont know how to do it.

My code is:

IF ISNULL(xApp) THEN //instantiate the variable
    xApp := xApp.ApplicationClass();
xMail := xApp.CreateItem(xItemType); //create the new mail
xMail."To" := FORMAT('E-mail'); //add the employee email
xMail.HTMLBody := 'Body';
xMail.BodyFormat := 2;
xMail.Display(TRUE); //show the window of outlook