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
Thanks Eduardo!
Sorry I forget, the dotnet variables run on the client, so change its propertis:
Property Value
RunOnClient Yes
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
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.
It would be nice, if you share your solution with us!
I Solved this, tank you.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156