Re: acessing addressbooks from two different profiles

From: Hugh J. Hitch*** (info_at_NO_SPAMwebdimensions.org)
Date: 10/20/04


Date: Wed, 20 Oct 2004 19:03:38 -0400

I would just go to the Contacts section, double-click where it says "double
click here to create new contact". Or, click on the "New Contact" icon at
the upper left in the toolbar.
then the form pops up and you enter stuff in.
-h

"Dmitry Streblechenko (MVP)" <dmitry@dimastr.com> wrote in message
news:OAWKRhvtEHA.820@TK2MSFTNGP12.phx.gbl...
> I mean how do you access and create new entries for that container in the
> Outlook UI?
>
> Dmitry Streblechenko (MVP)
> http://www.dimastr.com/
> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool
>
>
> "Hugh J. Hitch***" <info@NO_SPAMwebdimensions.org> wrote in message
> news:xpCdnfukxbDucevcRVn-jA@speakeasy.net...
> > Dmitri,
> > I'm not really even sure how I would determine that. When I double click
> on
> > its entry in Outlook Spy, it does say Outlook Address Book. However, the
> > only way I have been able to see the entries listed is by doing
> > AddressBook->GetPAB->GetContentsTable. when I do that I see all the
> entries
> > listed. I haven't been able to see them through the msgstore interface
> yet.
> > can you tell me how to do it?
> > thanks!
> >
> > "Dmitry Streblechenko (MVP)" <dmitry@dimastr.com> wrote in message
> > news:Om4LR#utEHA.2196@TK2MSFTNGP14.phx.gbl...
> > > But still, do the contacts that you see in the address book come from
> one
> > of
> > > the Contacts folders or from PAB?
> > > My point is that if you are using OAB (which uses IPM.Contact messages
> in
> > > one of the Contact folders), you can access the entries as messages in
> the
> > > store rather than through the Address Book interfaces.
> > >
> > > Dmitry Streblechenko (MVP)
> > > http://www.dimastr.com/
> > > OutlookSpy - Outlook, CDO
> > > and MAPI Developer Tool
> > >
> > >
> > > "Hugh J. Hitch***" <info@NO_SPAMwebdimensions.org> wrote in message
> > > news:wuOdnaM3eKsBUOvcRVn-rA@speakeasy.net...
> > > > Dmitri,
> > > >
> > > > I'm getting the default profile which in mosts cases will be a pop3
> > based
> > > > profile. From there, I'm calling Session->OpenAddressBook, then
> > > > AddressBook->GetDefaultDir() which in most cases in the life of our
> > > > application will be the Personal Address Book which is where
contacts
> > are
> > > > stored when you make them in outlook and add a contact. (I'm not
> really
> > > > concerned about other cases, however GetDefaultDir will generally
> return
> > > the
> > > > default place where the user has stored addresses.) . I've confirmed
> > that
> > > > this is where I want to get the contacts from.
> > > >
> > > > in the second profile, which is exchange based, the address book's
> > default
> > > > dir is always the Global Address List, and I don't want to store
them
> > > there.
> > > > Hence, on the second profile, I do Session->OpenAddressBook,
> > > > AddressBook->GetPAB, and then do Session->OpenEntry() on the PAB's
eid
> > and
> > > > then I create the entries at that level. I've confirmed that this is
> > where
> > > I
> > > > want to copy the contacts TO, and that the contacts end up where I
> want
> > > them
> > > > to be when I operate on this object.
> > > >
> > > > what I am having trouble doing, is to copy the entry from paragraph
#1
> > > into
> > > > the interface exposed in paragraph #2. I've tried copying generic
> > values,
> > > > and it works and everything ends up in the right place. The
> difficulty
> > is
> > > > getting the actual item from the source PAB into the destination
PAB.
> > For
> > > > some reason I thought maybe I would need a support object to open
the
> > > entry
> > > > before copying it, since I can't have two sessions open at once and
> copy
> > > > between them... or can I? obviously I could use some direction.
> > > >
> > > > any assistance will be greatly appreciated. thanks in advance!
> > > >
> > > > Hugh
> > > >
> > > > "Dmitry Streblechenko (MVP)" <dmitry@dimastr.com> wrote in message
> > > > news:ObzYOpttEHA.1048@tk2msftngp13.phx.gbl...
> > > > > Is it really PAB or OAB provider (based on the Contacts folder)?
> > > > >
> > > > > Dmitry Streblechenko (MVP)
> > > > > http://www.dimastr.com/
> > > > > OutlookSpy - Outlook, CDO
> > > > > and MAPI Developer Tool
> > > > >
> > > > >
> > > > > "Hugh J. Hitch***" <info@NO_SPAMwebdimensions.org> wrote in
message
> > > > > news:B6ydncyfNssjc-jcRVn-1A@speakeasy.net...
> > > > > > Hi Dmitri,
> > > > > >
> > > > > > as it turns out, I am trying to copy from the PAB of the
> pop3-based
> > > > > profile
> > > > > > to the PAB of the exchange-based profile. What I've discovered
is
> > that
> > > > if
> > > > > I
> > > > > > can copy from one PAB to the other, the background transport
> > > > automatically
> > > > > > uploads the new contact to the exchange server directory service
> in
> > my
> > > > > > Contacts list (PAB) on the exchange server.
> > > > > >
> > > > > > So far, I have been able to build an entrylist of contacts from
> PAB
> > > #1,
> > > > > > then by calling the AddrBk->GetPAB on the exchange based
profile,
> I
> > am
> > > > > able
> > > > > > to obtain a pointer to create entries on PAB # 2. I tried using
> > > > > > CopyEntries... I keep getting back an error message saying "An
> event
> > > was
> > > > > > unable to invoke any of the subscribers". Interestingly, though,
I
> > can
> > > > > > definitely see network activity so there is some exchange
between
> my
> > > > > program
> > > > > > and the exchange server when I do try CopyEntries() (but only
> after
> > > > > setting
> > > > > > all the flags to NULL).
> > > > > >
> > > > > > assuming I couldn't resolve the "An event was unable to invoke
any
> > of
> > > > the
> > > > > > subscribers" problem, I tried an alternative approach -- a
> for-next
> > > loop
> > > > > to
> > > > > > iterate through each entry id in the entrylist, calling a
> > > CreateEntry()
> > > > on
> > > > > > the PAB for each entry id in the Entrylist. Interestingly, that
> > > actually
> > > > > > works, however there is a weird phenomenon of an instance of
> Outlook
> > > > > opening
> > > > > > and closing for each time CreateEntry() called. I would prefer
not
> > to
> > > > have
> > > > > > this happen... Also, I have been able to create the entries that
> > way,
> > > > but
> > > > > > there is no data in any of the entries. From what I've
researched
> so
> > > > far,
> > > > > I
> > > > > > believe I am supposed to do an IMAPISupport->OpenEntry() call on
> the
> > > > > > entrylist item before calling the CreateEntry() on the new PAB,
to
> > > make
> > > > > sure
> > > > > > all the properties get copied over. I really haven't quite
figured
> > > this
> > > > > out
> > > > > > yet... any help will be greatly appreciated.
> > > > > >
> > > > > > one of the main problems I seem to be having is that I haven't
got
> > the
> > > > > > slightest idea how to obtain a pointer to an IMAPISupport
object,
> > > other
> > > > > than
> > > > > > it is supposed come from IABLogon somehow. I don't even know if
> that
> > > is
> > > > > > really relevant to what I am doing, but again, any help will be
> > > greatly
> > > > > > appreciated.
> > > > > >
> > > > > > Thanks Dmitri!
> > > > > >
> > > > > > Hugh
> > > > > >
> > > > > >
> > > > > >
> > > > > > "Dmitry Streblechenko (MVP)" <dmitry@dimastr.com> wrote in
message
> > > > > > news:#vjSxWhtEHA.2516@TK2MSFTNGP11.phx.gbl...
> > > > > > > So what exactly are the source and target address book
> providers?
> > > > > > >
> > > > > > > Dmitry Streblechenko (MVP)
> > > > > > > http://www.dimastr.com/
> > > > > > > OutlookSpy - Outlook, CDO
> > > > > > > and MAPI Developer Tool
> > > > > > >
> > > > > > >
> > > > > > > "Hugh J. Hitch***" <info@NO_SPAMwebdimensions.org> wrote in
> > message
> > > > > > > news:8OydnQ1T0c3xwuncRVn-gQ@speakeasy.net...
> > > > > > > > Hi,
> > > > > > > >
> > > > > > > > what I'm trying to do is open the address book from one
> profile,
> > > > then
> > > > > > > access
> > > > > > > > a second profile and copy the recipients listed in the first
> > > > profile's
> > > > > > > > addrbk's contents table to the second profile's address
book.
> > I'm
> > > > sure
> > > > > > > many
> > > > > > > > have done this... I am still struggling with conceptually
how
> to
> > > > make
> > > > > it
> > > > > > > > happen. I am able to get the entryid's for the two by
logging
> on
> > > to
> > > > > the
> > > > > > > > first profile, doing Session->OpenAddressBook,
> > > > > > > AddressBook->GetDefaultDir().
> > > > > > > > This returns an interface whose rows can be queried,
returning
> > the
> > > > > list
> > > > > > of
> > > > > > > > contacts in the profile's default contacts. (personal
address
> > book
> > > > if
> > > > > > pop3
> > > > > > > > probably, and directory service global address list if the
> > default
> > > > > > service
> > > > > > > > is exchange server.) the scenario I am attempting to deal
with
> > > > > involves
> > > > > > an
> > > > > > > > outlook user whose profile has a pop3 account and stores
> > contacts
> > > in
> > > > a
> > > > > > PAB
> > > > > > > > and I want to copy these entries into a new profile which
has
> > > > exchange
> > > > > > > > server as its default service. this should result in the
> > contacts
> > > > from
> > > > > > the
> > > > > > > > PAB from the first profile winding up on the exchange
server,
> in
> > > the
> > > > > > > user's
> > > > > > > > contacts book there on that server referenced by the new
> > profile.
> > > > > > > >
> > > > > > > > I'm thinking since it involves more than one profile, I will
> > need
> > > to
> > > > > do
> > > > > > > this
> > > > > > > > with something other than a session, perhaps an IMAPISupport
> > > object.
> > > > > > > However
> > > > > > > > I haven't got a clue how to instantiate one or even if
that's
> > what
> > > I
> > > > > > > should
> > > > > > > > use. Or perhaps I should just logon to profile one, get a
> > pointer
> > > to
> > > > > its
> > > > > > > > default addrbk dir, then logon to profile two, get its
default
> > > > addrbk
> > > > > > dir
> > > > > > > > ptr, then somehow copy recipients from the first ptr to the
> > second
> > > > > ptr.
> > > > > > > I've
> > > > > > > > also seen a function called CopyEntries, which seems like it
> > would
> > > > be
> > > > > > the
> > > > > > > > right thing, except it requires a Binary Array object of
> > entryids.
> > > > At
> > > > > > this
> > > > > > > > point I haven't got a clue how to, say, do an HrQueryAllRows
> > with
> > > > > > > PR_ENTRYID
> > > > > > > > being pulled and get them into a Binary Array. just don't
know
> > how
> > > > to
> > > > > do
> > > > > > > it.
> > > > > > > >
> > > > > > > > Could some kind, intelligent & knowledgeable soul out there
be
> > so
> > > > kind
> > > > > > as
> > > > > > > > to:
> > > > > > > > a] confirm that I have the right idea on how to do this, or
> > > > > > > > b] point me in the right direction
> > > > > > > > c] give me a nudge towards what I need to know to get this
> done.
> > > > > > > >
> > > > > > > > I will continue to research this on my own; meanwhile
profuse
> > > thanks
> > > > > in
> > > > > > > > advance for any assistance.
> > > > > > > >
> > > > > > > > Hugh
> > > > > > > > hjh at webdimensions dot org
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>