Microsoft KB Archive/321039

= PRB: &quot;80040E94&quot; or &quot;80040E09&quot; Error Message When You Use the IDataSource.Save Method After You Install Exchange 2000 SP2 =

Article ID: 321039

Article Last Modified on 8/25/2005

-

APPLIES TO


 * Microsoft Exchange 2000 Server Service Pack 2
 * Collaboration Data Objects for Exchange 2000

-



This article was previously published under Q321039



SYMPTOMS
If you use the IDataSource.Save method after you install Exchange 2000 Server Service Pack 2 (SP2), you may receive one of the following error messages:

80040E94: Caller requested write access to a read-only object

-or-

80040E09: Permission Denied



CAUSE
This behavior occurs because of a change in the implementation of the IDataSource.Open method in the CDO for Exchange 2000 (CDOEX) Library. By default, the Open method opens access to an object as adModeReadWrite in versions of Exchange Server earlier than Exchange 2000 Server SP2. However, in Exchange 2000 Server SP2, the Open method opens access to an object as adModeRead by default.



RESOLUTION
Call IDataSource.Open with the adModeReadWrite parameter before you call the IDataSource.Save method, as follows: oObject.DataSource.Open strSourceURL,, adModeReadWrite



STATUS
This behavior is by design.



CDO for Exchange 2000 (CDOEX) Sample
' CDOEX.vbs ' error 800040E09: Permission Denied. Const adFailIfNotExists = -1 Const adModeReadWrite = 3

Dim strUrl Dim objMessage strUrl = &quot;file://./backofficestorage/ /MBX/ &quot;

Set objMessage = CreateObject(&quot;CDO.Message&quot;) With objMessage .DataSource.Open strUrl & &quot;/ / .eml&quot;,, , adFailIfNotExists '.DataSource.Open strUrl & &quot;/ / .eml&quot;,, adModeReadWrite, adFailIfNotExists .Subject = &quot; &quot; .DataSource.Save End With Set objMessage = Nothing Msgbox &quot;Done&quot;

CDO for Exchange Management (CDOEXM) Sample
' CDOEXM.vbs ' error 80040E94: Caller requested write access to a read-only object. Const adModeReadWrite = 3

Dim objPerson Dim objMailRecip Dim strURL

strURL = &quot;LDAP:///CN= ,CN=Users,DC= ,DC=com&quot;

Set objPerson = CreateObject(&quot;CDO.Person&quot;) objPerson.Datasource.Open strURL 'objPerson.Datasource.Open strURL,, adModeReadWrite Set objMailRecip = objPerson.GetInterface(&quot;IMailRecipient&quot;) objPerson.DataSource.Save

Set objPerson = Nothing Set objMailRecip = Nothing Msgbox &quot;Done&quot;

Keywords: kberrmsg kbprb KB321039

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.