msoutlook.org Forum Index
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CDO Error

 
Post new topic   Reply to topic    msoutlook.org Forum Index -> MS Office Outlook
Author Message
bluesbrthr



Joined: 13 Aug 2007
Posts: 10

PostPosted: Mon Feb 11, 2008 4:02 pm    Post subject: CDO Error Reply with quote

I have an application that allows the user to create a recurring e-
mail. My issue is when I open the address book, select a name, and
then continue, I get an error. This used to work, but now I'm on a
different development computer since I first wrote it.

My CDO.DLL version is 6.5.7651.61

The exact line the code breaks on is:

AddRecipsViaCDO = AddRecipsViaCDO &
colCDORecips.Item(iRecipients).AddressEntry.Name & "; "


Error Number: -2147024891
Error Desc: [Collaboration Data Objects - [E_ACCESSDENIED(80070005)]]




My entire code is:

Private Function AddRecipsViaCDO() As String

Dim SafeContact, oContact
Dim iRecipients As Integer
Dim sAddresses As String
Dim oSession As MAPI.Session

Const cdoE_USER_CANCEL = &H80040113

'On Error Resume Next
' start CDO session
Set oSession = CreateObject("MAPI.Session")
oSession.Logon GetDefaultProfileName, , False, False

If Err.Number = -2147221231 Then
oSession.Logon , , True, False

ElseIf Err.Description = "[Collaboration Data Objects -
[MAPI_E_LOGON_FAILED(80040111)]]" Then
oSession.Logon , , True, False

Else
Debug.Print Err.Number & " : " & Err.Description

End If

' Show address book
Set colCDORecips = oSession.AddressBook(, "Choose Recipients", , , 1,
"Recipients")

If Err = 0 Then
For iRecipients = 1 To colCDORecips.Count
'This line invokes the Outlook Security
AddRecipsViaCDO = AddRecipsViaCDO &
colCDORecips.Item(iRecipients).AddressEntry.Name & "; "

Next iRecipients

For iRecipients = 1 To colCDORecips.Count
sAddresses = sAddresses &
colCDORecips.Item(iRecipients).AddressEntry.Address & "; "

Next iRecipients

AddRecipsViaCDO = Left(AddRecipsViaCDO, Len(AddRecipsViaCDO) - 3)
sAddresses = Left(sAddresses, Len(sAddresses) - 3)

ElseIf Err = cdoE_USER_CANCEL Then
' user canceled the address book dialog - do nothing or provide a
message to user
sAddresses = ""

End If

' release objects
oSession.Logoff
Set colCDORecips = Nothing
Set objRecip = Nothing
Set objCDORecip = Nothing
Set colRecips = Nothing
Set oSession = Nothing

gfEmail.Tag = sAddresses

End Function

Archived from group: microsoft>public>office>developer>outlook>vba
Back to top
View user's profile Send private message
Ken Slovak - [MVP - Outlo



Joined: 12 Aug 2007
Posts: 405

PostPosted: Mon Feb 11, 2008 9:23 pm    Post subject: Re: CDO Error Reply with quote

CDO 1.21 is subject to even stronger security than the Outlook object model
and has been since the Outlook 2000 SP2 days. Just accessing a Message
object in a Contacts folder fires the CDO security.

It looks like you're using Redemption, use that instead of CDO to access the
restricted information. Switch over to Redemption to get the message and use
Redemption methods from there to access the Recipients collection, etc.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


wrote in message @s8g2000prg.googlegroups.com...
>I have an application that allows the user to create a recurring e-
> mail. My issue is when I open the address book, select a name, and
> then continue, I get an error. This used to work, but now I'm on a
> different development computer since I first wrote it.
>
> My CDO.DLL version is 6.5.7651.61
>
> The exact line the code breaks on is:
>
> AddRecipsViaCDO = AddRecipsViaCDO &
> colCDORecips.Item(iRecipients).AddressEntry.Name & "; "
>
>
> Error Number: -2147024891
> Error Desc: [Collaboration Data Objects - [E_ACCESSDENIED(80070005)]]
>
>
>
>
> My entire code is:
>
> Private Function AddRecipsViaCDO() As String
>
> Dim SafeContact, oContact
> Dim iRecipients As Integer
> Dim sAddresses As String
> Dim oSession As MAPI.Session
>
> Const cdoE_USER_CANCEL = &H80040113
>
> 'On Error Resume Next
> ' start CDO session
> Set oSession = CreateObject("MAPI.Session")
> oSession.Logon GetDefaultProfileName, , False, False
>
> If Err.Number = -2147221231 Then
> oSession.Logon , , True, False
>
> ElseIf Err.Description = "[Collaboration Data Objects -
> [MAPI_E_LOGON_FAILED(80040111)]]" Then
> oSession.Logon , , True, False
>
> Else
> Debug.Print Err.Number & " : " & Err.Description
>
> End If
>
> ' Show address book
> Set colCDORecips = oSession.AddressBook(, "Choose Recipients", , , 1,
> "Recipients")
>
> If Err = 0 Then
> For iRecipients = 1 To colCDORecips.Count
> 'This line invokes the Outlook Security
> AddRecipsViaCDO = AddRecipsViaCDO &
> colCDORecips.Item(iRecipients).AddressEntry.Name & "; "
>
> Next iRecipients
>
> For iRecipients = 1 To colCDORecips.Count
> sAddresses = sAddresses &
> colCDORecips.Item(iRecipients).AddressEntry.Address & "; "
>
> Next iRecipients
>
> AddRecipsViaCDO = Left(AddRecipsViaCDO, Len(AddRecipsViaCDO) - 3)
> sAddresses = Left(sAddresses, Len(sAddresses) - 3)
>
> ElseIf Err = cdoE_USER_CANCEL Then
> ' user canceled the address book dialog - do nothing or provide a
> message to user
> sAddresses = ""
>
> End If
>
> ' release objects
> oSession.Logoff
> Set colCDORecips = Nothing
> Set objRecip = Nothing
> Set objCDORecip = Nothing
> Set colRecips = Nothing
> Set oSession = Nothing
>
> gfEmail.Tag = sAddresses
>
> End Function

Back to top
View user's profile Send private message
Display posts from previous:   
Related Topics:
Error Images Hi now everything works fine except than showing the image when displaying the message. I create the HTML Message add some embeeded images and send it. The sender sees the image and everythign is fine. But when I call Display() instead of Send() and the e

Outlook - Redemption. How to do an error handling? Hi, I'm using Redemption to send emails in my app code (Powerbuilder 10). If email address is invalid, say ""xxx.com or @@@.com - then call to the method crashes my application. Is there any easy and robust way to handle these kinds of

Error 3170 Can not find installable ISAM hello i have installed a program that was made in visual basic 6.0 that utilizes MS access 2003 . however, when i try to save or view the data (which it calls up the MSaccess file which it saves to), I get the error Error 3170: Can not find installable I

redemption SAfeMailItem.Send - what are error return codes? Hi, I'm trying to find out what are return error codes for the Redemption SafeMailItem Send method - I'd like to have something like : result = and then to inform user about cause of the error. TIA

Error 25090 - Office Source Engine, system error 2147024893 I have not been able to install any updates Office Outlook 2003 for approximately six months now. The event error suggests that I open C:\Program and look for "Office Source Engine" for information on how to
Post new topic   Reply to topic    msoutlook.org Forum Index -> MS Office Outlook All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group