Read a .msg file in NAV 2015
Baptiste2
Member Posts: 6
Hello everyone,
I want to extract the sender and receiver address from a .msg file from Nav. I'm working on a NAV 2015 server.
I can't read it from outlook.
I was looking for a DotNet or an Automation to do that, but I only found explanations to send an email.
Does anyone already faced that problem before and have some clue to give me.
Thank you.
Baptiste
I want to extract the sender and receiver address from a .msg file from Nav. I'm working on a NAV 2015 server.
I can't read it from outlook.
I was looking for a DotNet or an Automation to do that, but I only found explanations to send an email.
Does anyone already faced that problem before and have some clue to give me.
Thank you.
Baptiste
0
Comments
-
for NAV you'll probably have to write your own DotNet Interop Assembly
a good point to start is always....
http://bit.ly/1NyzbL90 -
Look for Rebex.com0
-
Yes I thought about create my own add-in, but I hoped there would be already something to start with.
Thank you anyway.0 -
With this DLL to wrap the call to CreatItemFromTemplate due to its second parameter (Type.Missing) that I can't make it works in NAV.
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.Office.Interop.Outlook; namespace MailItemClass { public class Class1 { public static MailItem getMailItem(string fichero) { Application outl = new Application(); MailItem item = (MailItem) outl.CreateItemFromTemplate(fichero, Type.Missing); return (item); } } }
An this codeunit with a example, you can read .msg filesOBJECT Codeunit 50113 Test read .msg { OBJECT-PROPERTIES { Date=31/03/15; Time=12:28:57; Modified=Yes; Version List=PRUEBA; } PROPERTIES { OnRun=BEGIN MailItem2 := MailItem2.Class1; msgFile := 'C:\PASO\prueba.msg'; MailItem := MailItem2.getMailItem(msgFile); MESSAGE('Send by: %1\\To: %2', MailItem.SenderEmailAddress, MailItem."To"); END; } CODE { VAR MailItem2@1000000000 : DotNet "'MailItemClass, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.MailItemClass.Class1" RUNONCLIENT; MailItem@1000000001 : DotNet "'Microsoft.Office.Interop.Outlook, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'.Microsoft.Office.Interop.Outlook.MailItem" RUNONCLIENT; msgFile@1000000002 : Text; BEGIN END. } }
I can post a link to the DLL if you want it.
Regards.0 -
Thank you for your sample.

I want to add some modifications, but it will give me a good base to start with.0 -
Thank you for your sample.

I want to add some modifications, but it will give me a good base to start with.0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 610 NAV Courses, Exams & Certification
- 1.9K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 251 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
