This repository has been archived by the owner on Feb 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
NAV 2015 and later versions installation
Matteo Parlato edited this page Nov 7, 2019
·
1 revision
Here are described the changes you need to make in order to integrate OutlookCOMM in NAV 2015 and later versions.
- Copy the OutlookCOMM.NET.dll into the Add-in folder placed inside NAV service folder.
- Restart NAV service(s).
Here are the changes you need to apply to NAV objects in order to use OutlookCOMM:
Codeunit 397 - Mail
PROCEDURE NewMessageAsync@1000(ToAddresses@1001 : Text;CcAddresses@1002 : Text;BccAddresses@1000 : Text;Subject@1003 : Text;Body@1004 : Text;AttachFilename@1005 : Text;ShowNewMailDialogOnSend@1006 : Boolean) : Boolean;
VAR
UserSetup@1101318000 : Record 91;
OCOMM@1101318001 : DotNet "'OutlookCOMM.NET, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.OutlookCOMM.NET.MailUtilities" RUNONCLIENT;
BEGIN
// Start OutlookCOMM/mpar
// ORG: EXIT(CreateAndSendMessage(ToAddresses,CcAddresses,BccAddresses,Subject,Body,AttachFilename,ShowNewMailDialogOnSend,FALSE));
IF UserSetup.GET(USERID) AND UserSetup."Use alternative E-Mail sending" AND ShowNewMailDialogOnSend THEN BEGIN
OCOMM := OCOMM.MailUtilities(UserSetup."E-Mail", ToAddresses, CcAddresses, BccAddresses, Subject, Body);
OCOMM.UseOutlookAccount := UserSetup."Use Outlook Account sender";
OCOMM.AddAttachment(AttachFilename, '');
EXIT(OCOMM.SaveEML);
END ELSE
EXIT(CreateAndSendMessage(ToAddresses,CcAddresses,BccAddresses,Subject,Body,AttachFilename,ShowNewMailDialogOnSend,FALSE));
// Stop OutlookCOMM/mpar
END;
PROCEDURE NewMessage@2(ToAddresses@1001 : Text;CcAddresses@1002 : Text;BccAddresses@1000 : Text;Subject@1003 : Text;Body@1004 : Text;AttachFilename@1005 : Text;ShowNewMailDialogOnSend@1006 : Boolean) : Boolean;
VAR
UserSetup@1101318001 : Record 91;
OCOMM@1101318000 : DotNet "'OutlookCOMM.NET, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.OutlookCOMM.NET.MailUtilities" RUNONCLIENT;
BEGIN
// Start OutlookCOMM/mpar
// ORG: EXIT(CreateAndSendMessage(ToAddresses,CcAddresses,BccAddresses,Subject,Body,AttachFilename,ShowNewMailDialogOnSend,TRUE));
IF UserSetup.GET(USERID) AND UserSetup."Use alternative E-Mail sending" AND ShowNewMailDialogOnSend THEN BEGIN
OCOMM := OCOMM.MailUtilities(UserSetup."E-Mail", ToAddresses, CcAddresses, BccAddresses, Subject, Body);
OCOMM.UseOutlookAccount := UserSetup."Use Outlook Account sender";
OCOMM.AddAttachment(AttachFilename, '');
EXIT(OCOMM.SaveEML);
END ELSE
EXIT(CreateAndSendMessage(ToAddresses,CcAddresses,BccAddresses,Subject,Body,AttachFilename,ShowNewMailDialogOnSend,TRUE));
// Stop OutlookCOMM/mpar
END;
Table 91 - User Setup
{ 50000; ;Use alternative E-Mail sending;Boolean;
CaptionML=[ENU=Use alternative E-Mail sending;
ITA=Usa metodo invio E-Mail alternativo];
Description=OutlookCOMM, enables or disables the usage of the alternative E-Mail sending method for the user }
{ 50001; ;Use Outlook Account sender;Boolean ;InitValue=Yes;
CaptionML=[ENU=Use Outlook account as sender address;
ITA=Usa indirizzo mittente dell'account di Outlook];
Description=OutlookCOMM, if enabled use Outlook E-Mail account as sender address otherwise use the value in the E-Mail field }
Codeunit 9520 - Mail Management
LOCAL PROCEDURE SendMailOnWinClient@3() : Boolean;
VAR
Mail@1003 : Codeunit 397;
FileManagement@1006 : Codeunit 419;
ClientAttachmentFilePath@1005 : Text;
ClientAttachmentFullName@1009 : Text;
BodyText@1000 : Text;
OCOMM@1101318001 : DotNet "'OutlookCOMM.NET, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.OutlookCOMM.NET.MailUtilities" RUNONCLIENT;
UserSetup@1101318000 : Record 91;
EMLFilePath@1101318002 : Text;
BEGIN
// Start OutlookCOMM/mpar
IF UserSetup.GET(USERID) AND UserSetup."Use alternative E-Mail sending" THEN BEGIN
CheckValidEmailAddress(TempEmailItem."Send to");
OCOMM := OCOMM.MailUtilities(UserSetup."E-Mail", ToAddresses, CcAddresses, BccAddresses, Subject, ImageBase64ToUrl(TempEmailItem.GetBodyText));
OCOMM.UseOutlookAccount := UserSetup."Use Outlook Account sender";
OCOMM.AddAttachment(TempEmailItem."Attachment File Path", TempEmailItem."Attachment Name");
EXIT(OCOMM.SaveEML);
END;
// Stop OutlookCOMM/mpar
.
.
.
END;
.
.
.
PROCEDURE SendMailOrDownload@17(TempEmailItem@1002 : TEMPORARY Record 9500;HideMailDialog@1000 : Boolean);
VAR
MailManagement@1001 : Codeunit 9520;
UserSetup@1101318001 : Record 91;
OCOMM@1101318000 : DotNet "'OutlookCOMM.NET, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.OutlookCOMM.NET.MailUtilities" RUNONCLIENT;
EMLFilePath@1101318002 : Text;
BEGIN
// Start OutlookCOMM/mpar
IF UserSetup.GET(USERID) AND UserSetup."Use alternative E-Mail sending" THEN BEGIN
CheckValidEmailAddress(TempEmailItem."Send to");
OCOMM := OCOMM.MailUtilities(UserSetup."E-Mail", ToAddresses, CcAddresses, BccAddresses, Subject, ImageBase64ToUrl(TempEmailItem.GetBodyText));
OCOMM.UseOutlookAccount := UserSetup."Use Outlook Account sender";
OCOMM.AddAttachment(TempEmailItem."Attachment File Path", TempEmailItem."Attachment Name");
EXIT(OCOMM.SaveEML);
END;
// Stop OutlookCOMM/mpar
.
.
.
END;
Page 18006682 - User Setup Card
ActionList=ACTIONS
{
{ 1101318004; ;ActionContainer;
ActionContainerType=ActionItems }
{ 1101318006;1 ;Action ;
Name=Test Alternative Sending Method;
CaptionML=[ENU=Test alternative E-Mail sending method;
ITA=Esegui test invio E-Mail alternativo];
Promoted=Yes;
Enabled="Use alternative E-Mail sending";
PromotedIsBig=Yes;
Image=MailSetup;
PromotedCategory=Process;
PromotedOnly=Yes;
OnAction=VAR
OCOMM@1101318000 : DotNet "'OutlookCOMM.NET, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.OutlookCOMM.NET.MailUtilities" RUNONCLIENT;
OCOMMErrorText@1101318001 : TextConst 'ENU=An error occurred while using OutlookCOMM component;ITA=Si Š verificato un errore nell''uso del componente OutlookCOMM';
BEGIN
IF NOT "Use Outlook Account sender" THEN
TESTFIELD("E-Mail");
OCOMM := OCOMM.MailUtilities("E-Mail", 'to@example.com', 'cc@example.com', 'bcc@example.com', 'Subject', 'Body');
OCOMM.UseOutlookAccount := "Use Outlook Account sender";
OCOMM.AddAttachment('C:\fin.flf', 'Secret.bck');
IF NOT OCOMM.SaveEML THEN
MESSAGE(OCOMMErrorText);
END;
}
}
.
.
.
{ 1101318002;1;Group ;
CaptionML=[ENU=OutlookCOMM;
ITA=OutlookCOMM];
GroupType=Group }
{ 1101318003;2;Field ;
ToolTipML=[ENU=Enable this feature only if the traditional E-Mail sending through the direct call to the Outlook component does not work properly.;
ITA=Abilita questa funzione solo se l'invio E-Mail tradizionale tramite la chiamata diretta al componente di Outlook non funziona correttamente.];
SourceExpr="Use alternative E-Mail sending" }
{ 1101318005;2;Field ;
ToolTipML=[ENU=If enabled use Outlook email account as sender address otherwise use the value defined in the E-Mail field.;
ITA=Se abilitato, utilizza l'account e-mail di Outlook come indirizzo mittente, altrimenti utilizza il valore definito nel campo E-mail.];
SourceExpr="Use Outlook Account sender";
Enabled="Use alternative E-Mail sending" }
To enable the alternative e-mail sending method you need to enable the "Use alternative E-Mail sending" flag:
If you want to use the e-mail defined in the "User setup" instead of the one configured in Outlook you need to fill the field "E-Mail" with a valid e-mail address.
When enabled, you can test the alternative e-mail sending method just by pressing the "Test alternative E-Mail sending method" button in the "HOME" panel of the ribbon.