PRB: Access Denied Using CDO from VBScript

Last reviewed: February 9, 1998
Article ID: Q179104
The information in this article applies to:
  • Collaboration Data Objects (CDO), versions 1.1, 1.2

SYMPTOMS

You may receive the error "Access Denied" trying to invoke certain properties of Collaboration Data Objects (CDO) 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 library is installed on the test
   'computer 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 library tested for client-side use, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q171440
   TITLE     : INFO: Where to Acquire the Active Messaging Libraries

For additional information about Collaboration Data Objects versus Active Messaging, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q176916
   TITLE     : INFO: Active Messaging and Collaboration Data Objects (CDO)

Keywords          : ActMsg OLEMSG cdo
Version           : WINDOWS:1.1,1.2
Platform          : WINDOWS
Issue type        : kbprb


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 9, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.