Programmatically adding Outlook address book services?

F

Falconetti Daniel

Hello,
I'm desperatly looking for a way to add outlook address book service to a
profile that I create.
I can add the service using "CONTAB" but I've got lot of difficulties
finding the minimum property set to define.
I had a look thru Profman2 and found some values such :
6622 which is correspond to the source of the contact folder (either Mailbox
or Public folder)
6623 name of the contact folders
6624 display name of the folder
.....
But I can't figure out which properties to define as the ones above should
be filled from properties on the folder!

Can somebody help

Thanks a lot
 
D

Dmitry Streblechenko \(MVP\)

That's exactly the problem - OAB provider stores a bunch of PT_MV_xxx
properties with the folder names, folder entry ids and store entry ids, but
you cannot set these properties until you access a particular message store.

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

Falconetti Daniel

Thks for your answer.
Well... How can I do?
I really need to be able to resolve address from the contact folder!
Due to the limitation of distribution list size, I create several smaller
ones that I want to put in a master one!
and then I need to resolve the recipient collection containing the small
lists to be able to put them in the master one!
All that programmatically for a thousand of Mailboxes so I need to create
the profile and delete it afterwards!

So if you have any suggestions I'd be very pleased.

Thks
 
D

Dmitry Streblechenko \(MVP\)

Well, you can try to log to the profile first, then update the OAB provider
properties in its IProfSect with the entry ids etc of the contacts
folder(s) where you created the contacts. There is a very good chance that
the OAB provider won't pick up the changes until the next time it is loaded.
Or (since you know where the OAB entries come from) you can skip the name
resolution completely and simply populate message recipient properties
(PR_ENTRYID, PR_DISPLAY_NAME, PR_ADDRRTYPE, PR_EMAIL_ADDRESS)
programmatically without ever calling IAddrBook::ResolveNames().

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

Falconetti Daniel

Hi,

I'm not far from finding a way but...
My program runs on a W2K SP3 server With Exch 5.5 SP4 and Outlook 2K SR1
I use profman.dll
I can create the profile, I can add the MSEMS service but when it comes to
adding CONTAB service I get an error "enable to add a service"
I tried to use profman.exe from the MSDN and got the same problem so it's
not coming specifically from my apps or profman.dll
I tried it on a client PC and I could create the both services!

Any idea?

thks

Daniel Falconetti
 
D

Dmitry Streblechenko \(MVP\)

This is most likely because CONTAB service is not in mapisvc.inf - search
your hard drive to see if you have more than one instance of that file.

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

Falconetti Daniel

Thks,

content are different between system32\mapisv.inf and the one installed from
Outlook!

To avoïd problems I've decided to launch the appli from a client station and
it's Ok.

For my initial question here is the piece of code which make it
Dim......
Set objProfiles = CreateObject("ProfMan.Profiles")
Set objProfMan = objProfiles.Add(strMailbox, False, False)
Set ExchService = objProfMan.Services.Add("MSEMS", "Microsoft Exchange",
False)
Set ExchProperties = CreateObject("ProfMan.PropertyBag")
ExchProperties.Add PR_PROFILE_UNRESOLVED_SERVER, strExServeur
ExchProperties.Add PR_PROFILE_UNRESOLVED_NAME, strMailbox
ExchService.Configure uiNever, , ExchProperties
Set CABService = objProfMan.Services.Add("CONTAB", "Carnet d'adresse
Outlook", False)
Set CABProperties = CreateObject("ProfMan.PropertyBag") 'Don't know
if it's necessary haven't tested it without yet!
CABService.Configure uiNever, , CABProperties

Set ExchService = Nothing
Set ExchProperties = Nothing
Set CABService = Nothing
Set CABProperties = Nothing


Set olSession = CreateObject("outlook.Application") 'olSession
est en fait un objet application (olApp)
Set olNS = olSession.GetNamespace("MAPI")
olNS.Logon Profile:=strMailbox, showDialog:=False, NewSession:=True
Set olContactFolder = olNS.GetDefaultFolder(olFolderContacts)
Tempo(5) ' That's a sub that wait for 5 seconds It allows
sufficiant time for the Contact folder to mount as an Outlook Address Book

Hope that will serve!
dmitry, you can add it to your site if you think it's worth it

Thk for your help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top