Outlook window does not close

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

Outlook window does not close
using OSM, Outlook window does not automatically close after send mail 
Ruby Rob




Posts: 2
Joined: 2006-12-14
hi,

I purchased and installed Outlook Security Manager and used it to develop a software for my client. I used OSM to disable the warning message that pops up when an attachment is sent using Outlook.

I installed and tested the software on my clients application. Initially, it was working fine but now my clients are telling me that it does not work as before. Whats happening now is that when the "Send mail" button in my application is clicked, it opens an Outlook window with the addresses, subject, message and attachment as programmed. But when the "Send" button on the window is clicked, the window does not close automatically as it used to before. The content cannot be edited but the menus (File, etc.) can be accessed. Before a week or so, the program was working fine with the window closing as soon as the mail was sent. Now, the recipient receives the mail but an unnecessary window is open on the sender's PC. Can you tell me why this is happening? Is there any action that I should be performing in my application?

Below is the code that I use when the "Send mail" button on my application is clicked:

try
{
	//Open outlook with default values for subject and body
	Outlook.ApplicationClass outlookApp = new Outlook.ApplicationClass();
	Outlook.MailItem oMailItem = (Outlook.MailItem)outlookApp.CreateItem(Outlook.OlItemType.olMailItem);
	secMgr.ConnectTo(outlookApp);
				secMgr.DisableOOMWarnings = true;

	oMailItem.To = EmailID;
	oMailItem.CC = tempToId;
	oMailItem.Subject = ParNumber + " Reminder";
	string body = "The necessary follow up is done";
	oMailItem.Body = body;
			
	try
	{
		if (chkBoxAtchPdfPt2.Checked == true)
		{
			//for adding report attachment
			String rptSource = mailRptPath;
			String attachName = "Report";
			int iPosition  = (int)oMailItem.Body.Length + 1;
			int iAttachType = (int)Outlook.OlAttachmentType.olByValue;
			Outlook.Attachment oAttach = oMailItem.Attachments.Add(rptSource, iAttachType, iPosition, attachName);
		}
	}
	catch(Exception ex)
	{
		MessageBox.Show(ex.Message);
	}
	oMailItem.Display(Modal);
}
catch(Exception ex)
{
	MessageBox.Show(ex.Message);
}
finally
{
	secMgr.DisableOOMWarnings = false;
}


Thanks and regards,
Ruby.
Posted 14 Dec, 2006 05:23:32 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Ruby.

Please try to modify the finally block as shown below.

........
Finally
{
secMgr.DisableOOMWarnings = false;
Marshal.ReleaseComObject(oMailItem);
Marshal.ReleaseComObject(outlookApp);
}


P.S. Note that we take up your forum requests in the order we receive them.
Besides, it may take us some time to investigate your issue. Please be sure we will let you know as soon as the best possible solution is found.
Posted 14 Dec, 2006 16:35:38 Top
rubysbox




Posts: 2
Joined: 2006-12-14
hi Sergey,

I modified the finally block as u suggested, but the problem persists. The outlook window still does not close after the Send button is clicked. i have searched the net in case it is an Outlook problem, but am not able to find any information online. Can you suggest another solution?

Thanks and regards,
Ruby.
Posted 18 Dec, 2006 06:36:29 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Ruby.

I have just sent you an email. Please check your inbox.
Posted 18 Dec, 2006 08:49:30 Top