Issue with Multiple Mail Attachments

Cyberghost
Member Posts: 46
Hi
I have been playing around with the Email routines in NAV, specifically the Mail codeunit 397 and trying to send multiple attachments by Outlook.
However, what seems to be a simple modification is being anything but!
I have added a function which is based on the standard CreateAndSendMessage function, but accepts an Array of AttachFilenames. This then calls the standard AttachFile function in a loop. See below.
However when attaching the second file NAV or Outlook seem to get it's knickers in a twist and comes up with the following error.
Microsoft Outlook is not available.
Do you want to continue to edit the e-mail?
I haven't been able to resolve this so thought I'd see if anyone had any clues. We are using NAV 2016 and Outlook 2013.
I have this working via SMTP but also need to have it working via Outlook.
Thanks in advance.
Chris
I have been playing around with the Email routines in NAV, specifically the Mail codeunit 397 and trying to send multiple attachments by Outlook.
However, what seems to be a simple modification is being anything but!
I have added a function which is based on the standard CreateAndSendMessage function, but accepts an Array of AttachFilenames. This then calls the standard AttachFile function in a loop. See below.
LOCAL CreateAndSendMessageMultipleAttachments(ToAddresses : Text;CcAddresses : Text;BccAddresses : Text;Subject : Text;Body : Text;AttachFilenames : ARRAY [4] OF Text;ShowNewMailDialogOnSend : Boolean;RunModal : Boolean) : Boolean // -001 Initialize; CreateMessage(ToAddresses,CcAddresses,BccAddresses,Subject,Body,ShowNewMailDialogOnSend,RunModal); FOR Loop := 1 TO 4 DO IF AttachFilenames[Loop] <> '' THEN AttachFile(AttachFilenames[Loop]); EXIT(Send); // +001 AttachFile(Filename : Text) Initialize; IF Filename <> '' THEN OutlookMessageHelper.AttachmentFileNames.Add(Filename);
However when attaching the second file NAV or Outlook seem to get it's knickers in a twist and comes up with the following error.
Microsoft Outlook is not available.
Do you want to continue to edit the e-mail?
I haven't been able to resolve this so thought I'd see if anyone had any clues. We are using NAV 2016 and Outlook 2013.
I have this working via SMTP but also need to have it working via Outlook.
Thanks in advance.
Chris
"When you eliminate the impossible, whatever remains, however improbable, must be the truth" - Sherlock Holmes
"God and developers are in a constant battle. Developments to make their applications more idiot-proof, and God to produce bigger idiots!"
"God and developers are in a constant battle. Developments to make their applications more idiot-proof, and God to produce bigger idiots!"
1
Best Answer
-
I resolved this. It turned out to be an error with the file and an unhelpful error message"When you eliminate the impossible, whatever remains, however improbable, must be the truth" - Sherlock Holmes
"God and developers are in a constant battle. Developments to make their applications more idiot-proof, and God to produce bigger idiots!"6
Answers
-
I resolved this. It turned out to be an error with the file and an unhelpful error message"When you eliminate the impossible, whatever remains, however improbable, must be the truth" - Sherlock Holmes
"God and developers are in a constant battle. Developments to make their applications more idiot-proof, and God to produce bigger idiots!"6 -
Had the same problem. And you answer was helpfull.
The filename must be a reference to a client file.
Tino Ruijs
Microsoft Dynamics NAV specialist1 -
Microsoft Outlook is not available error can also be because of "old" subkeys under HKEY_CLASSES_ROOT\TypeLib\{00062FFF-0000-0000-C000-000000000046} / HKEY_CLASSES_ROOT\WOW6432Node\TypeLib\{00062FFF-0000-0000-C000-000000000046} if you have/had multiple versions of Outlook installed.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions