The type NavAutomation is unknown


I am using the standard dotNet interop libraries/variables to communicate with outlook (Microsoft.Office.Interop.Outlook, Version= well while using the client, but, when using the NAS to call the GetMail functions (RunOnClient=No), I get the following error:

The type NavAutomation is unknown

The code where this error is happening is this:

IF LItems.Count >0 THEN BEGIN

LMailItem := LItems.GetFirst; // NavAutomation Error

LItems DotNet Microsoft.Office.Interop.Outlook.Items.'Microsoft.Office.Interop.Outlook, Version=

LMailItem DotNet Microsoft.Office.Interop.Outlook.MailItem.'Microsoft.Office.Interop.Outlook, Version=

so, no classic Automations are involved here.

this could be a .NET Type Casting error, but again, it does work perfectly when being run on the client.

Do you have any idea what this can be?

Thank you in advance!

which nav version do you use ?

if version < 2013 then it won’t work. use an automation instead.


Thank you for your reply.

I am using NAV 2015, Outlook 2013, on Windows Server 2012 R2 Standard, so I don’t think automations can be used here.

Thank you

using the windows client, then the outlook dll from the client pc is called.

running in nas the outlook dll is searched on the server, where the nav service resided. is it installed there?

i think its also needed, that outlook/office is installed on the server.


the dll exists in the server, and is also present in the add-ins folders.

I have changed some code to create the object MailItem differently with

ApplicationClass := ApplicationClass.ApplicationClass();

MailItem := ApplicationClass.CreateItem(0);

Then again, works perfectly when running on client but just doesn’t work on NAS, with the same error

NAS Server is on the NAV Server, which is where I am testing, with Outlook installed there. Also checked the DCOM permissions on the Server Components and looks good (although when running on a client, the application asks for my permission).

Also, same error happens with NAV 2016.


Thank you again
(gmail was sending DUG notification emails to the spam folder, hence not seing this before)

how do you create the instance of ApplicationClass for client use and for server use? should be different.

Hi Jonathan,

they are being created the same way, only one contructor… guess I am missing something here? can you please point me in the right direction? google isn’t doing the trick…

Thank you in advance


and check the third parameter for client or server usage.

Hi Jonathan,

because Automation objects cannot run on Microsoft Dynamics NAV Server, I am using dotNet variables.

The create function which you sent me only works with automations (NAV won’t even compile automations if created on the server side).

RunOnClient is set to NO on the variables and the error is being triggered on the attribution of MailItem := ApplicationClass.CreateItem(0);

so no luck so far…

Thank you

i did a little research and found your issue in the comments to the article. it may be helpful for you:

Thanks Jonathan, Iºd seen that one as well, unfortunately doesnºt work here.


i did a lot of tests. repeated your trials. didn’t work too, no way. so i think, the reason for not working could be that it’s not a common assembly like mscorlib or system - i tried with them, no problems at all - it is an interop assembly. means, it was created from the automation, a kind of a wrapper for usage in .net apps. works well in .net apps, but not in that case.

so, as a solution/workaround i recommend to develope a new .net assembly referencing the original outlook automation or the interop lib. then try again with that new assembly instead of the interop.

Hi Boom-box,

I’m very interested in this subject too, so I would like to know if you found a solution?

after developing a c# wrapper for that outlook automation, it seems tha’s in first place a problem with dcom security settings.

for that follow

for each user running the job queue there are permisisons needed.

a complete other approach is using ews: the exchange web services: