Working with CDO using VBScript
<SCRIPT LANGUAGE=vbscript>
Sub but_OnClick
Dim objSession, sOS, StrProfileName
Set objSession = CreateObject("MAPI.Session")
set sOS = objSession.OperatingSystem
' look up for the windows NT registry key
if left (sOS,29) = "Microsoft Windows 2000 5.00.2195" then
'if left(sOS,29) = "Microsoft Windows 95(TM) 4.10" then
' HKCU\Software\Microsoft\Windows NT\Current Version\Windows Messaging Subsystem\Profiles\Default Profile
StrProfileName = "HKCU\Software\Microsoft\Windows NT\Current Version\Windows Messaging Subsystem\Profiles\Default Profile"
else
' look up for the windows registry key
' HKCU\Software\Microsoft\Windows Messaging Subsystem\Profiles\Default Profile
StrProfileName = "HKCU\Software\Microsoft\Windows Messaging Subsystem\Profiles\Default Profile"
end if
objSession.Logon StrProfileName'"Microsoft Outlook"
MsgBox objSession.Inbox.Messages.Count 'This fails w/Access Denied
objSession.Logoff
End Sub
</SCRIPT>
when i call the sub it says Error - [CDO - [E_ACCESSDENIED(80070005)]]
Ramesh Bharatha
|