HELP! Automating adding a public contacts folder in Exchange to OAB 
Author Message
 HELP! Automating adding a public contacts folder in Exchange to OAB

I'm trying to write a VBA script to add a public contacts folder to Outlook
Address Book.  I started using this code to test what's returned:
--------------------------------------------------------------
Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNameSpace("MAPI")
Set myAddressList = myNameSpace.AddressLists(1)
Set myAddressEntries = myAddressList.AddressEntries(1)
msgbox myAddressEntries, vbokonly
--------------------------------------------------------------

This is just returning my GAL.  I can't access the Outlook Address Book
that's in there.  The AddressLists Collection has a length of one.  I can't
seem to get any methods or properties on the AddressLists Collection on the
web site because of scripting errors.

Any help would be appreciated, I've looked under the Office and Exchange
sites.

Matt



Sat, 14 Feb 2004 03:06:48 GMT  
 HELP! Automating adding a public contacts folder in Exchange to OAB
If AddressLists has only 1 member then no Outlook contacts folder is
enabled as an Outlook address book. Adding one as an AB in code isn't
supported in the Outlook object model unless you are using Outlook
2002. Otherwise you'd have to use Extended MAPI.

If you have a contacts folder enabled as an AB then
AddressLists("Contacts") would work to get it as an AddressList.

--
Ken Slovak
[MVP - Outlook]
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Lead Author, Beginning Visual Basic 6 Application Development, Wrox
Press


Quote:
> I'm trying to write a VBA script to add a public contacts folder to
Outlook
> Address Book.  I started using this code to test what's returned:
> --------------------------------------------------------------
> Set myOlApp = CreateObject("Outlook.Application")
> Set myNameSpace = myOlApp.GetNameSpace("MAPI")
> Set myAddressList = myNameSpace.AddressLists(1)
> Set myAddressEntries = myAddressList.AddressEntries(1)
> msgbox myAddressEntries, vbokonly
> --------------------------------------------------------------

> This is just returning my GAL.  I can't access the Outlook Address
Book
> that's in there.  The AddressLists Collection has a length of one.
I can't
> seem to get any methods or properties on the AddressLists Collection
on the
> web site because of scripting errors.

> Any help would be appreciated, I've looked under the Office and
Exchange
> sites.

> Matt



Sat, 14 Feb 2004 03:53:36 GMT  
 HELP! Automating adding a public contacts folder in Exchange to OAB
That's what's puzzling.  I had both contacts and the public folder contacts
enabled for use in OAB, but the only Address List showing up was the GAL.  I
can't read the names of the address lists in Contacts or Public Contacts.  I
can only access them through folders.

MD



Quote:
> If AddressLists has only 1 member then no Outlook contacts folder is
> enabled as an Outlook address book. Adding one as an AB in code isn't
> supported in the Outlook object model unless you are using Outlook
> 2002. Otherwise you'd have to use Extended MAPI.

> If you have a contacts folder enabled as an AB then
> AddressLists("Contacts") would work to get it as an AddressList.

> --
> Ken Slovak
> [MVP - Outlook]
> Lead Author, Professional Outlook 2000 Programming, Wrox Press
> Lead Author, Beginning Visual Basic 6 Application Development, Wrox
> Press



> > I'm trying to write a VBA script to add a public contacts folder to
> Outlook
> > Address Book.  I started using this code to test what's returned:
> > --------------------------------------------------------------
> > Set myOlApp = CreateObject("Outlook.Application")
> > Set myNameSpace = myOlApp.GetNameSpace("MAPI")
> > Set myAddressList = myNameSpace.AddressLists(1)
> > Set myAddressEntries = myAddressList.AddressEntries(1)
> > msgbox myAddressEntries, vbokonly
> > --------------------------------------------------------------

> > This is just returning my GAL.  I can't access the Outlook Address
> Book
> > that's in there.  The AddressLists Collection has a length of one.
> I can't
> > seem to get any methods or properties on the AddressLists Collection
> on the
> > web site because of scripting errors.

> > Any help would be appreciated, I've looked under the Office and
> Exchange
> > sites.

> > Matt



Sat, 14 Feb 2004 04:22:47 GMT  
 HELP! Automating adding a public contacts folder in Exchange to OAB
Are you positive they are enabled? Check in the folder Properties on
the Outlook Address Book tab.

I just ran this Outlook VBA macro and got the names of the GAL, all my
AB enabled contacts folders (both private and public folders) and my
PAB in the Immediate window.

Sub ALs()
Dim oALs As Outlook.AddressLists
Dim oAL As Outlook.AddressList

Set oALs = Application.GetNamespace("MAPI").AddressLists
For Each oAL In oALs
  Debug.Print oAL.Name
Next

Set oALs = Nothing
Set oAL = Nothing

End Sub

--
Ken Slovak
[MVP - Outlook]
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Lead Author, Beginning Visual Basic 6 Application Development, Wrox
Press


Quote:
> That's what's puzzling.  I had both contacts and the public folder
contacts
> enabled for use in OAB, but the only Address List showing up was the
GAL.  I
> can't read the names of the address lists in Contacts or Public
Contacts.  I
> can only access them through folders.

> MD


message

> > If AddressLists has only 1 member then no Outlook contacts folder
is
> > enabled as an Outlook address book. Adding one as an AB in code
isn't
> > supported in the Outlook object model unless you are using Outlook
> > 2002. Otherwise you'd have to use Extended MAPI.

> > If you have a contacts folder enabled as an AB then
> > AddressLists("Contacts") would work to get it as an AddressList.

> > --
> > Ken Slovak
> > [MVP - Outlook]
> > Lead Author, Professional Outlook 2000 Programming, Wrox Press
> > Lead Author, Beginning Visual Basic 6 Application Development,
Wrox
> > Press



> > > I'm trying to write a VBA script to add a public contacts folder
to
> > Outlook
> > > Address Book.  I started using this code to test what's
returned:
> > > --------------------------------------------------------------
> > > Set myOlApp = CreateObject("Outlook.Application")
> > > Set myNameSpace = myOlApp.GetNameSpace("MAPI")
> > > Set myAddressList = myNameSpace.AddressLists(1)
> > > Set myAddressEntries = myAddressList.AddressEntries(1)
> > > msgbox myAddressEntries, vbokonly
> > > --------------------------------------------------------------

> > > This is just returning my GAL.  I can't access the Outlook
Address
> > Book
> > > that's in there.  The AddressLists Collection has a length of
one.
> > I can't
> > > seem to get any methods or properties on the AddressLists
Collection
> > on the
> > > web site because of scripting errors.

> > > Any help would be appreciated, I've looked under the Office and
> > Exchange
> > > sites.

> > > Matt



Sat, 14 Feb 2004 05:04:10 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Importing Contacts from Access to Exchange Public folder

2. Text file to an Exchange Public Folder - Contacts

3. Using Crystal Reports 8.5 to Report Fields From Public Contacts Folder on Exchange 5.5 Server

4. How do I add a contact to a public folder programatically

5. Adding/Deleting Contacts in Public Folders

6. Public Folder Contact folders.

7. Syncronize in programmatic way, the folder Contact with the public folder

8. Email address from a public contact folder - PLEASE HELP

9. HELP!!! Creating Contacts on Public Folders

10. Add contact information to folder other than default folder

11. Resolve Contact to Public Folder

12. Need sample code for read public folder contact into access

 

 
Powered by phpBB® Forum Software