Why? CDO 1.21 always raises security prompts.
Is this code for Outlook VBA? If so, this is your problem:
Dim ol As New Outlook.Application
Instead, use the intrinsic Application object that Outlook VBA exposes:
Set ol = Application
or just
Set olns = Application.GetNamespace(MAPI)

Signature
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
>I have the following VBA code that uses MAPI to get a user's Appointments.
> It generates the dreaded security access dialog, so i want to use CDO
[quoted text clipped - 18 lines]
>
> Thanks!
Sorry that I failed to mention it is in Access VBA.
I commented out the whole line "Dim ol As New Outlook.Application"
and just did a straight "Set olns = Outlook.Application.GetNamespace("MAPI")"
and I still got the security warning.
Thanks so much for your help!
> Why? CDO 1.21 always raises security prompts.
>
[quoted text clipped - 32 lines]
> >
> > Thanks!
Ken Slovak - [MVP - Outlook] - 25 Jan 2008 16:35 GMT
From outside the Outlook VBA, like in Access VBA, you would use New
Outlook.Application.
However, you aren't understanding that the project reference to MAPI is
actually CDO 1.21 and your MAPI.Session is a CDO Session object. CDO is
restricted and no matter what you do if you use it you will get the security
prompts.
I think you are confusing Extended MAPI with CDO (MAPI). Extended MAPI has a
huge learning curve and cannot be programmed using VBA, only C++ or Delphi
in unmanaged code.

Signature
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
> Sorry that I failed to mention it is in Access VBA.
>
[quoted text clipped - 5 lines]
>
> Thanks so much for your help!
Sue Mosher [MVP-Outlook] - 25 Jan 2008 17:09 GMT
That's hugely relevant. External Outlook automation is going to raise security prompts in versions before Outlook 2007. See http://www.outlookcode.com/article.aspx?ID=52 for your options.

Signature
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
> Sorry that I failed to mention it is in Access VBA.
>
[quoted text clipped - 18 lines]
>>
>> Set olns = Application.GetNamespace(MAPI)
>> >I have the following VBA code that uses MAPI to get a user's Appointments.
>> > It generates the dreaded security access dialog, so i want to use CDO
[quoted text clipped - 18 lines]
>> >
>> > Thanks!