"The parameter is incorrect" exception

Add-in Express™ Support Service
That's what is more important than anything else

"The parameter is incorrect" exception
How get rid of "The parameter is incorrect" exception. 
Ivan Pankov




Posts: 1
Joined: 2007-04-11
Hallo!


I have an ASP.NET web project and I have a trouble using OutlookSecurityManager there. Here is a code:


        ' Create Outlook application instance
        Dim OutlookApplication As New Outlook.ApplicationClass

        ' Get outlook namespace
        Dim OutlookNamespace As Outlook.NameSpaceClass = OutlookApplication.GetNamespace("MAPI")

        ' Turn off security warnings
        Dim OutlookSecurityManager As New AddInExpress.OutlookSecurityManagerClass

        ' Connect security manager to outlook application
        OutlookSecurityManager.ConnectTo(OutlookApplication)

        ' Disable warnings
        OutlookSecurityManager.DisableOOMWarnings = True
        OutlookSecurityManager.DisableCDOWarnings = True
        OutlookSecurityManager.DisableSMAPIWarnings = True

        ' Some Outlook processing code goes here...

        ' Enable warnings back
        OutlookSecurityManager.DisableOOMWarnings = False
        OutlookSecurityManager.DisableCDOWarnings = False
        OutlookSecurityManager.DisableSMAPIWarnings = False


"The parameter is incorrect" exception is throwed on this line:
OutlookSecurityManager.ConnectTo(OutlookApplication)


Absolutely the same code works fine on the same computer in my other windows project. For web application I have:

<authentication mode="Windows"/>
<identity impersonate="true"/>

in web.config. Also I tried to use/not use Visual Studio debugger and tried to build in debug/release modes. It does not affect this exception. I tried to comment the line which throws an exception, but in this case the other line throws another exception (System.Runtime.InteropServices.COMException "Unspecified error"):
OutlookSecurityManager.DisableSMAPIWarnings = True


And without DisableSMAPIWarnings = True I get Outlook security warnings, so I have to have this one turned off.

How can I make
OutlookSecurityManager.ConnectTo(OutlookApplication)
line working?


Thanks!
Posted 11 Apr, 2007 13:09:07 Top
Sergey Grischenko


Add-in Express team


Posts: 7187
Joined: 2004-07-05
Hi Ivan.

The fact is that the Outlook Object Model doesn't work correctly in ASP.NET applications.
I think the problem is caused by to some security settings.
I would advise you to use CDO or Simple MAPI in ASP.NET applications.
Also please read the following article:
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q257757


P.S. Note that we take up your forum requests in the order we receive them.
Besides, it may take us some time to investigate your issue. Please be sure we will let you know as soon as the best possible solution is found.
Posted 12 Apr, 2007 08:56:35 Top