PRB: Access Denied Using CDO (1.x) from VBScript (179104)



The information in this article applies to:

  • Collaboration Data Objects (CDO) 1.1
  • Collaboration Data Objects (CDO) 1.2
  • Collaboration Data Objects (CDO) 1.21

This article was previously published under Q179104

SYMPTOMS

You may receive the error "Access Denied" trying to invoke certain properties of Collaboration Data Objects (1.1, 1.2, 1.21) objects from VBScript (VBS) when the same operation succeeds from a Visual Basic application.

STATUS

This behavior is by design to ensure the security of message stores and address books.

MORE INFORMATION

Steps to Reproduce Behavior

   'Following is the VBScript code to reproduce the behavior:
   'This sample assumes that the CDO (1.1, 1.2, 1.21) library is installed
   'on the test system and that a profile named "Microsoft Outlook"
   'exists.

   Sub but_OnClick
     Dim objSession
     Set objSession = CreateObject("mapi.session")
     objSession.Logon "Microsoft Outlook"
     MsgBox objSession.Inbox.Messages.Count 'This fails w/Access Denied
     objSession.Logoff
   End Sub
				
NOTE: This issue does not occur with all properties and methods; some operations (like sending messages) and some properties operate as expected.

REFERENCES

For information on where to acquire the most recent version of the CDO (1.x) Libraries, please see the following article in the Microsoft Knowledge Base:

171440 INFO: Where to Acquire the Collaboration Data Objects Libraries


Modification Type:MajorLast Reviewed:5/9/2005
Keywords:kberrmsg kbMsg kbprb KB179104