> Set objSession = CreateObject("MAPI.Session")
> objSession.Logon "", "", False, True, 0, True, sHost & vbLf & "SMTP:"
[quoted text clipped - 5 lines]
> object is used without the logon have been called.
> This is clearly not the case here.
The problem is that the session doesn't actually do the login until you
try and do something with the session that needs the login to have
happened. So if you do, say:
oSession.Logon ...
.. some other code ..
Folder f = oSession.Inbox ' This is when the actual logon happens
That's why you're seeing the error.
> The funny part is, that if I take the same code and run it as a
> VBScript from the commandline (on the web server),
> it works fine and no MAPI_E_NOT_INITIALZED is thrown.
Are you running as the same user as the web server user? For some more
tips on using CDO1.21 from ASP, see:
http://www.cdolive.com/asp.htm
-- dan
Mogens Olesen - 12 Sep 2005 10:53 GMT
Sorry, I probably wasn't precise enough expressing my question.
The exception doesn't happen after, but during or at the call af the
oSession.Logon.
The 'Folder f = oSession.InBox' part is never called.
>> Set objSession = CreateObject("MAPI.Session")
>> objSession.Logon "", "", False, True, 0, True, sHost & vbLf & "SMTP:"
[quoted text clipped - 26 lines]
>
> -- dan
>I have for some time tried to solve an anoying problem I've had after a
>migration
[quoted text clipped - 23 lines]
>
> HELP!!
Each time I've seen this, it's been caused by a problem with the CDO
ProfileDirectory:
http://support.microsoft.com/default.aspx?scid=kb;en-us;166599
If you have created this profile directory, then make sure that the account
you are running the script as has permission to create/delete files in it.
Lee.

Signature
___________________________________
Outlook Web Access for PDA and WAP:
www.leederbyshire.com
___________________________________
Mogens Olesen - 12 Sep 2005 17:27 GMT
Well I have already tried this one. But apparently with no help. The Temp
folder used to
store the MMP files have everyone full control.
I also think that if this was an issue, the problem should be the same
wether you run it by
the WEB-app or by the command line script.
And by the way I use Basic authentication on the web-page, and do the tests
logged in as the same user when running the command line script as well on
the
web page.
>>I have for some time tried to solve an anoying problem I've had after a
>>migration
[quoted text clipped - 34 lines]
>
> Lee.
Lee Derbyshire [MVP] - 12 Sep 2005 18:01 GMT
> Well I have already tried this one. But apparently with no help. The Temp
> folder used to
[quoted text clipped - 9 lines]
> the
> web page.
IIS only reads the registry value once - the first time it needs it. A
script might read it each time it is run (although I don't actually know if
it would, or not). If you tried your CDO app before the registry key had
been created, you would need to stop/start IIS otherwise it will continue to
try and put them in the server's system directory C:\WINDOWS.
It might be worth using filemon to see if any mmp files are being
successfully created.
Lee.

Signature
___________________________________
Outlook Web Access for PDA and WAP:
www.leederbyshire.com
___________________________________
systemConsultant - 29 Nov 2005 20:50 GMT
Lee, I am having the same problem.
The Intranet site is trying to access a public store contact folder on
Exchange 2003.
I'm trying to move an Intranet site to a new W2K3 Server (from W2K Server)
but this error is making me crazy too.
I have set all permissions, changed registry settings, even changed
anonymous login to administrator for both local mahcine and domain. I used
iisreset as and even restarting server completely after all changes to make
sure nothing was remembered.
Just as Olesen, I can put it in a vbs file and it works perfectly although
the Outlook client prompts me to allow permission.
This code for gives 500 Internal Server Error
Dim objSession
Set objSession = Server.CreateObject("MAPI.Session")
if objSession is nothing then
response.write "Not working...?"
else
response.write objSession.username
end if
Origianl Code gives MAPI_E_NOT_INITIALIZED error at the logon
const ServerName = "HPT-MX1"
const UserName = "Administrator"
Set objSession = CreateObject ("MAPI.Session")
strProfileInfo = ServerName & vbLf & UserName
objSession.Logon "", "", False, True, 0, False, strProfileInfo
Even if I do nothing after the logon I still get the error.