MAPIHandler not working with Outlook 2007?

LilithyanLilithyan Member Posts: 32
Hello,

sorry if this question has already been asked somewhere else, but I've been searching the Forum and googling for at least half a day and haven't come any closer to the answer I need.

We have a Customer who has Navision 3.70 Objekts running in a 6.00 Classic Client. The Customer wants to send out E-Mails with one attachment and no more than two adresses to send to. He also want's to look the mail over before acutally sending it, so Outlook has to open with everything already inserted (body, attachment, etc.).

So I used the Mail Codeunit (397), which has the MapiHandler. The Problem is, that Outllok doesn't open. No errormessage, nothing. When only running the function NewMessage the returnvariable is false.

What does this mean? Is Outllok 2007 not compatible with the old code of the function? Would it be possible to use a newer version of the codeunit? The NAVW16.00 Version doesn't use Navision Attain ApplicationHandler.Mapihandler but a bunch of 'NS Outlook Synchronization Handler' Automations, which seem to work just fine.

Thanks for any help in advance!

Ciao,

Lilithyan

Comments

  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    Try writing your own mail codeunit using automation vars which point to 'Microsoft Outlook XX Object Library.MailItem' directly. I did it once to store mails in the Draft folder.
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • fverkelfverkel Member Posts: 66
    Yes indeed, that doesn't work.

    You could write your own CodeUnit, or just replace functions in CodeUnit 397 with the versions from NAV2009.
    I've done that, it works.

    Replace these functions: OpenNewMessage, NewMessage, AddBodyLine, Send, GetErrorCode, GetErrorDesc
    Add this one: GetMailGUIDFieldName

    By the way, in your situation you don't get an error message automatically, but with the functions GetErrorCode and GetErrorDesc you would get
    errorcode 429 ActiveX Component can't create object

    By the way, the functions from Navision 2.60 would actually work! A bit different from NAV2009, but they do work.

    One curieus thing. Function AddBodyLine did not seem to generate a CR/LF, so I added the CR/LF from the C/AL-code. Don't know why.

    You can add an attachment, use multiple body lines, use multiple e-mail addresses.
    I've tested this with Office 2010 and 2003.
    Keep It Simple and Stupid (KISS), but never oversimplify.
  • Remco_ReinkingRemco_Reinking Member Posts: 74
    Other way to solve this is to register and use the dll's coming with the 3.70 (or 4.0sp1) install. In this particular case that is the NSAppHandler.dll
Sign In or Register to comment.