-
Notifications
You must be signed in to change notification settings - Fork 1
Home
OutlookCOMM is a component which can be used in Microsoft Dynamics NAV as a workaround when Outlook can't be opened by NAV when composing or sending e-mails.
- NAV Classic or NAV 2009 RTC installation
- NAV 2013 installation
- NAV 2013R2 installation
- NAV 2015 and later versions
For all those who want to extend the functionality or fix bugs (hope not) here are the prerequisites for developing OutlookCOMM:
- Visual Studio 2017+ with .NET desktop development workload.
- Microsoft Dynamics NAV 2009R2 (Classic) or any previous version for COM interface tests.
- Microsoft Dynamics NAV 2009R2 (RTC) or any later version for .NET library tests.
- Any email client with *.eml file support (Outlook or Thunderbird recommended).
It's possible to test OutlookCOMM without NAV using the OutlookCOMM.Test project available in the OutlookCOMM Visual Studio solution (which uses OutlookCOMM.NET).
When editing OutlookCOMM keep in mind that Generics classes and methods can't be exposed to COM (TlbExp warning TX8013117D) so it's necessary to add the COMVisible attribute to everything using Generics:
namespace OutlookCOMM.Core
{
public abstract class MailUtilitiesBase : IMailUtilities
{
// Properties
// List<T> and KeyValuePair<TKey,TValue> both belongs to System.Collections.Generic namespace so it's
// necessary to hide the COM visibility of the Attachment class property
[ComVisible(false)]
public List<KeyValuePair<string, string>> Attachments { get; } = new List<KeyValuePair<string, string>>();
// Methods
}
}
Also remember to use using and the Dispose() method to free all the unmanaged resources used by OutlookCOMM (such as attachment files):
MailMessage message = new MailMessage();
PrepareMessage(ref message);
PrepareAttachments(ref message); // Attachment files locked by OutlookCOMM/finsql process
using (SmtpClient smtpClient = new SmtpClient { DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory, PickupDirectoryLocation = TempPath })
{
// Save the created message to the disk instead of calling the default mail client
smtpClient.Send(message); // *.eml file locked by OutlookCOMM/finsql process
} // *.eml file released
message.Dispose(); // Attachment files released
Any exception fired by OutlookCOMM will be registed inside Windows "Applications" event log so take a look at Windows Event Viewer logs when testing and debugging in NAV.