Skip to main content

Notifications

Microsoft Dynamics NAV (Archived)

Outlook 2016 and NAV 2016

Posted on by Microsoft Employee

Hi everyone, i need help :( , how can I to send a file attach in outlook 2016, what I need to do? I try use the "Microsoft.Dynamics.Nav.Integration.Office.Outlook.IOutlookMessage.'Microsoft.Dynamics.Nav.Integration.Office, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'" but dont work,I had Office 2013 and this dll works fine, but I after update to Office 2016 this dll dont work more, the NAV client shows this error [E_ACCESSDENIED(80070005),
now I try to use the

"Microsoft.Office.Interop.Outlook.ApplicationClass.'Microsoft.Office.Interop.Outlook, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'" but mark an error creating the instance. Any idea how can I do?

Thanks for the help and really so sorry for my english.

*This post is locked for comments

  • Binesh Profile Picture
    Binesh 7,885 on at
    RE: Outlook 2016 and NAV 2016

    Thanks Eduardo!

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Outlook 2016 and NAV 2016

    Sorry I forget, the dotnet variables run on the client, so change  its propertis:

    Property        Value

    RunOnClient Yes

  • Suggested answer
    Binesh Profile Picture
    Binesh 7,885 on at
    RE: Outlook 2016 and NAV 2016

    Hello ehernandez,

    I got an exception, when execute bellow line, my RTC automatically closed, And nothing happened.

    olMail := olapp.CreateItem(OlItemType);//create the new mail

     

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Outlook 2016 and NAV 2016

    Ok we need these Dotnet Variables

    Name DataType Subtype
    olapp DotNet Microsoft.Office.Interop.Outlook.ApplicationClass.'Microsoft.Office.Interop.Outlook, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
    olMail DotNet Microsoft.Office.Interop.Outlook.MailItem.'Microsoft.Office.Interop.Outlook, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
    OlItemType DotNet Microsoft.Office.Interop.Outlook.OlItemType.'Microsoft.Office.Interop.Outlook, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
    olAttachType DotNet Microsoft.Office.Interop.Outlook.OlAttachmentType.'Microsoft.Office.Interop.Outlook, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
    BodyFormats DotNet Microsoft.Office.Interop.Outlook.OlBodyFormat.'Microsoft.Office.Interop.Outlook, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'

    IF ISNULL(olapp) THEN //instantiate the variable
      olapp := olapp.ApplicationClass();
    olMail := olapp.CreateItem(OlItemType);//create the new mail
    
    olMail."To" := FORMAT(Customer."E-Mail"); //add the customer email
      SendCC := FORMAT(Customer."E-mail CC");//optional CC email
      olMail.CC := SendCC;//optional CC email
      olMail.Subject := CompanyName + ', Factura Electrónica: '+ SalesInvoiceHeader."No.";//Subject
      olMail.BodyFormat:= BodyFormats.olFormatHTML(); // optional BODY format HTML
      olMail.HTMLBody := BodyEmail+'<br><br><br>'+footer+footer2+footer3; //add the body
    olMail.Attachments.Add(XMLtoAttach,olAttachType.olByValue,1,Name+'.xml'); //attach the file, first the patch, next the function and finally the filename in the email.
    
    olMail.Display(TRUE); //show the window of outlook
    olMail.Send; // optional Automatic send email.


  • HILBE Profile Picture
    HILBE 300 on at
    RE: Outlook 2016 and NAV 2016

    It would be nice, if you share your solution with us!

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Outlook 2016 and NAV 2016

    I Solved this, tank you.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans