BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to retrieve all Outlook Contact folders

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation
View previous topic :: View next topic  
Author Message
Guenter
Guest





PostPosted: Fri Apr 15, 2005 9:20 pm    Post subject: How to retrieve all Outlook Contact folders Reply with quote




Hi,
how can I get all Outlook contact folders? The default one and if exists all custom contact folders. To get the default one and all the other folders is really easy, but I need to get only all Contact folders.
Anyone an idee how to do it?

Guenter
Back to top
Chris Trueman
Guest





PostPosted: Fri Apr 15, 2005 9:51 pm    Post subject: Re: How to retrieve all Outlook Contact folders Reply with quote



Walk the folders hierarchy and test each one to see if it contains
contact items.


Chris.

Quote:
how can I get all Outlook contact folders? The default one and if
exists all custom contact folders. To get the default one and all the
other folders is really easy, but I need to get only all Contact
folders. Anyone an idee how to do it?

Back to top
Guenter
Guest





PostPosted: Sat Apr 16, 2005 4:26 pm    Post subject: Re: How to retrieve all Outlook Contact folders Reply with quote




That's OK if the individual contact folders has items. But what if not?

Guenter

"Chris Trueman" <ctrueman (AT) wavesoftware (DOT) com> wrote:
Quote:
Walk the folders hierarchy and test each one to see if it contains
contact items.


Chris.

how can I get all Outlook contact folders? The default one and if
exists all custom contact folders. To get the default one and all the
other folders is really easy, but I need to get only all Contact
folders. Anyone an idee how to do it?


Back to top
Iv Kozhuharov
Guest





PostPosted: Sun Apr 17, 2005 8:29 am    Post subject: Re: How to retrieve all Outlook Contact folders Reply with quote

:-)

Walk the folders hierarchy and test each one for property
PR_CONTAINER_CLASS



Code below assumed that is used Active Messaging (CDO 1.21) :



{

The ActMsgPR_CONTAINER_CLASS property

was originally meant to contain a text string

describing the type of a folder.

If Folder not have this field (PR_CONTAINER_CLASS) exception is
raised.

}

try


strCONTAINER_CLASS:=VarToStr(objFolder.Fields.Item[ActMsgPR_CONTAINER_CLASS]
..Value);



if AnsiSameText(strCONTAINER_CLASS, 'IPF.Note') then

// SOME CODE

else

if AnsiSameText(strCONTAINER_CLASS, 'IPF.Appointment') then

// SOME CODE

else

if AnsiSameText(strCONTAINER_CLASS, 'IPF.Contact') then

// SOME CODE

else

if AnsiSameText(strCONTAINER_CLASS, 'IPF.StickyNote') then

// SOME CODE

else

if AnsiSameText(strCONTAINER_CLASS, 'IPF.Jurnal') then

// SOME CODE

else

if AnsiSameText(strCONTAINER_CLASS, 'IPF.Task') then

// SOME CODE

else

// SOME CODE;

except

on E:EOleSysError do

// We check that ErrorCode=HRESULT($8004010F)

// = MAPI_E_NOT_FOUND

// Field (PR_CONTAINER_CLASS) not exist

if (E.ErrorCode<>HRESULT($8004010F)) then

raise EOleSysError.Create(E.Message, E.ErrorCode,0);

end;


Regards,
Iv Kozhuharov
http://www.imibo.com/imidev/



"Guenter" <gsdata (AT) t-online (DOT) de> wrote

Quote:

Hi,
how can I get all Outlook contact folders? The default one and if exists
all custom contact folders. To get the default one and all the other folders

is really easy, but I need to get only all Contact folders.
Quote:
Anyone an idee how to do it?

Guenter



Back to top
Dmitry Streblechenko
Guest





PostPosted: Mon Apr 18, 2005 10:06 pm    Post subject: Re: How to retrieve all Outlook Contact folders Reply with quote

Why does it matter? If there are no items, there is nothing to do; move to
the next folder.
Start with the Namespace.Folders collection, then recursively process each
subfolder using MAPIFolder.Folders collection. Do make sure the
MAPIFolder.DefaultItemClass property is 2 (olContactItem).

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Guenter" <gsdata (AT) t-online (DOT) de> wrote

Quote:

That's OK if the individual contact folders has items. But what if not?

Guenter

"Chris Trueman" <ctrueman (AT) wavesoftware (DOT) com> wrote:
Walk the folders hierarchy and test each one to see if it contains
contact items.


Chris.

how can I get all Outlook contact folders? The default one and if
exists all custom contact folders. To get the default one and all the
other folders is really easy, but I need to get only all Contact
folders. Anyone an idee how to do it?




Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation 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, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.