Board index » delphi » Read Outlook Calendar Appointments

Read Outlook Calendar Appointments

Does anybody have a code snip showing how to read
this months' appointments from a Outlook 2000 Calendar?
I know it is a FAQ, but I couldn't find any working examples.

Best regards Thomas Riedel, LogiHouse

 

Re:Read Outlook Calendar Appointments


This is the Code that I use.  
Enjoy.
Trey Aughenbaugh

You need..ComCtrls, ComObj, and possibly some others in your uses clause.

procedure TForm1.Button1Click(Sender: TObject);
var
  CDOSession,
  oFolder,
  oMessages,
  oMsg,
  oRcpt,
  oFilter,
  oAppointment:       Variant;
Begin
CDOSession := CreateOleObject('MAPI.Session');

//You may have to change this line to work with your settings.
//Try it with Outlook open.  Will have to change
//the code for when Outlook is closed.
CDOSession.logon('MS Exchange Settings');

oFolder := CDOSession.GetDefaultFolder(0);
oMessages := oFolder.Messages;
oFilter :=  oMessages.Filter;

oFilter.Fields.add(6291520, '5/29/2002 11:59 PM');
oFilter.Fields.add(6357056, '5/20/2002 12:00 AM');

oAppointment := oMessages.GetFirst;
while Not (VarIsEmpty(oAppointment) or VarIsClear(oAppointment)) do
begin
if oAppointment.Subject <> '' then
 begin
 showmessage(oAppointment.Subject);
 showmessage(oAppointment.location);
 showmessage(oAppointment.starttime);
 showmessage(oAppointment.endtime);
 end;

 oAppointment := oMessages.GetNext;

end;
CDOSession.logoff;
end;

Quote
"Thor" <t...@image.danmark> wrote in message <news:3cf70645$1_1@dnews>...
> Does anybody have a code snip showing how to read
> this months' appointments from a Outlook 2000 Calendar?
> I know it is a FAQ, but I couldn't find any working examples.

> Best regards Thomas Riedel, LogiHouse

Re:Read Outlook Calendar Appointments


Thank you!

Quote
"Trey Aughenbaugh" <treyaughenba...@hotmail.com> wrote in message

news:20f0e51e.0205310543.483d6397@posting.google.com...
Quote
> This is the Code that I use.
> Enjoy.
> Trey Aughenbaugh

> You need..ComCtrls, ComObj, and possibly some others in your uses clause.

> procedure TForm1.Button1Click(Sender: TObject);
> var
>   CDOSession,
>   oFolder,
>   oMessages,
>   oMsg,
>   oRcpt,
>   oFilter,
>   oAppointment:       Variant;
> Begin
> CDOSession := CreateOleObject('MAPI.Session');

> //You may have to change this line to work with your settings.
> //Try it with Outlook open.  Will have to change
> //the code for when Outlook is closed.
> CDOSession.logon('MS Exchange Settings');

> oFolder := CDOSession.GetDefaultFolder(0);
> oMessages := oFolder.Messages;
> oFilter :=  oMessages.Filter;

> oFilter.Fields.add(6291520, '5/29/2002 11:59 PM');
> oFilter.Fields.add(6357056, '5/20/2002 12:00 AM');

> oAppointment := oMessages.GetFirst;
> while Not (VarIsEmpty(oAppointment) or VarIsClear(oAppointment)) do
> begin
> if oAppointment.Subject <> '' then
>  begin
>  showmessage(oAppointment.Subject);
>  showmessage(oAppointment.location);
>  showmessage(oAppointment.starttime);
>  showmessage(oAppointment.endtime);
>  end;

>  oAppointment := oMessages.GetNext;

> end;
> CDOSession.logoff;
> end;

> "Thor" <t...@image.danmark> wrote in message <news:3cf70645$1_1@dnews>...
> > Does anybody have a code snip showing how to read
> > this months' appointments from a Outlook 2000 Calendar?
> > I know it is a FAQ, but I couldn't find any working examples.

> > Best regards Thomas Riedel, LogiHouse

Other Threads