Microsoft KB Archive/266724

= PRB: Access Denied Error When You Set a Property in the Global Address List (GAL) =

Article ID: 266724

Article Last Modified on 3/4/2004

-

APPLIES TO


 * Microsoft Collaboration Data Objects 1.2
 * Microsoft Collaboration Data Objects 1.21

-



This article was previously published under Q266724



SYMPTOMS
When you attempt to set a property in the Microsoft Exchange Global Address List (GAL) to an empty string, you may receive the following error message:

You do not have sufficient permission to perform this operation on this object. [Microsoft Exchange Address Book - [E_ACCESSDENIED(80070005)]]



CAUSE
This error message is misleading because it is only displayed when you attempt to set the property to an empty string.



RESOLUTION
To work around this problem, check the new value before you set the property: if NewNum = &quot;&quot; Then objAddressEntry.Fields(myMAPIProperty) = vbEmpty 'Empty in VBScript Else objAddressEntry.Fields(myMAPIProperty) = NewNum End If



Steps to Reproduce Problem
Run the following code in Microsoft Visual Basic:

NOTE: The code assumes that you have a reference to the Microsoft Collaboration Data Objects (CDO) Library version 1.2 or later within your Visual Basic project. Dim StrServer 'Exchange Server Name. DIm StrUser 'User account with permissions to modify global address list. Dim CdoPR_HOME_TELEPHONE_NUMBER

'Set the Hex value for Home Phone 2. CdoPR_HOME2_TELEPHONE_NUMBER = &H3A2F001E

'Create the MAPI object. Set objSession = CreateObject(&quot;MAPI.Session&quot;)

'Connect to the Exchange Server. objSession.Logon, , False, False, , True, strServer & vbLf & strUser

'Open the GAL and apply a filter for the current user. Set objAddrEntries = objSession.AddressLists(&quot;Global Address List&quot;).AddressEntries Set objFilter = objAddrEntries.Filter objFilter.Fields.Add CdoPR_ACCOUNT, StrUser Set objAddressEntry = objAddrEntries(1)

'The error occurs on this line: objAddressEntry.Fields(CdoPR_HOME2_TELEPHONE_NUMBER) = &quot;&quot; NOTE: You can substitute the last line of code with any one of the following: objAddressEntry.Fields(CdoPR_HOME2_TELEPHONE_NUMBER) = vbEmpty objAddressEntry.Fields(CdoPR_HOME2_TELEPHONE_NUMBER) = Null objAddressEntry.Fields(CdoPR_HOME2_TELEPHONE_NUMBER) = &quot;90823098&quot;

Keywords: kbmsg kbprb KB266724

-

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

© Microsoft Corporation. All rights reserved.