![]() |
| If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|||||||
| Tags: combobox, contact, folder, populate, public |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Hi,
After some searching I found this article: http://support.microsoft.com/default...;en-us;290818& It's very nice, but what I need to do is populate the combobox with contacts from a contacts folder stored under public folders... is there a way to do this?? |
| Ads |
|
#2
|
|||
|
|||
|
To get a non-default folder, you need to walk the folder hierarchy using the Folders collections or use a function that does that for you. See http://www.outlookcode.com/d/code/getfolder.htm and, especially for public folders, http://www.outlookcode.com/codedetail.aspx?id=1164
After you have the folder, the technique is the same as in the article you cited. -- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "Pazuzu" wrote in message ... Hi, After some searching I found this article: http://support.microsoft.com/default...;en-us;290818& It's very nice, but what I need to do is populate the combobox with contacts from a contacts folder stored under public folders... is there a way to do this?? |
|
#3
|
|||
|
|||
|
Thanks alot for your answer! All works fine! The only thing I can't manage to
do now is to get the names from the GAL. My Contacts folder works fine with: Set objSession = Application.GetNameSpace("MAPI") Set objContactFolder = objSession.GetDefaultFolder(10) Set objAllContacts = objContactFolder.Items My public contacts folder works fine with: Set objSession = Application.GetNameSpace("MAPI") Set objContactFolder = GetPublicFolder("External contacts") Set objAllContacts = objContactFolder.Items But when I try this for the GAL... Set objSession = Application.GetNameSpace("MAPI") Const CdoAddressListGAL = 0 Set objAddressList = objSession.GetAddressList(CdoAddressListGAL) Set objAddressEntries = objAddressList.AddressEntries .... it fails with the erromessage: Object doesn't support this property or method: 'objSession.GetAddressList' Why oh why? "Sue Mosher [MVP-Outlook]" wrote: To get a non-default folder, you need to walk the folder hierarchy using the Folders collections or use a function that does that for you. See http://www.outlookcode.com/d/code/getfolder.htm and, especially for public folders, http://www.outlookcode.com/codedetail.aspx?id=1164 After you have the folder, the technique is the same as in the article you cited. -- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "Pazuzu" wrote in message ... Hi, After some searching I found this article: http://support.microsoft.com/default...;en-us;290818& It's very nice, but what I need to do is populate the combobox with contacts from a contacts folder stored under public folders... is there a way to do this?? |
|
#4
|
|||
|
|||
|
Looks like you're confusing the Session objects in CDO 1.21 and Outlook. In Outlook, you must get the address list from the Namespace.AddressLists collection.
-- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "Pazuzu" wrote in message ... Thanks alot for your answer! All works fine! The only thing I can't manage to do now is to get the names from the GAL. My Contacts folder works fine with: Set objSession = Application.GetNameSpace("MAPI") Set objContactFolder = objSession.GetDefaultFolder(10) Set objAllContacts = objContactFolder.Items My public contacts folder works fine with: Set objSession = Application.GetNameSpace("MAPI") Set objContactFolder = GetPublicFolder("External contacts") Set objAllContacts = objContactFolder.Items But when I try this for the GAL... Set objSession = Application.GetNameSpace("MAPI") Const CdoAddressListGAL = 0 Set objAddressList = objSession.GetAddressList(CdoAddressListGAL) Set objAddressEntries = objAddressList.AddressEntries ... it fails with the erromessage: Object doesn't support this property or method: 'objSession.GetAddressList' Why oh why? |
|
#5
|
|||
|
|||
|
I hoped I wouldn't need CDO since I don't know what it is. But after some
researching/parrot-coding i found the solution, by changing the first two lines to this: Set objSession = CreateObject("MAPI.Session") objSession.Logon "", "", False, False, 0 The only problem now is that is asks for permission to read the address book but I will try to solve that with Outlook Redemption. Thanks! "Sue Mosher [MVP-Outlook]" skrev: Looks like you're confusing the Session objects in CDO 1.21 and Outlook. In Outlook, you must get the address list from the Namespace.AddressLists collection. -- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "Pazuzu" wrote in message ... Thanks alot for your answer! All works fine! The only thing I can't manage to do now is to get the names from the GAL. My Contacts folder works fine with: Set objSession = Application.GetNameSpace("MAPI") Set objContactFolder = objSession.GetDefaultFolder(10) Set objAllContacts = objContactFolder.Items My public contacts folder works fine with: Set objSession = Application.GetNameSpace("MAPI") Set objContactFolder = GetPublicFolder("External contacts") Set objAllContacts = objContactFolder.Items But when I try this for the GAL... Set objSession = Application.GetNameSpace("MAPI") Const CdoAddressListGAL = 0 Set objAddressList = objSession.GetAddressList(CdoAddressListGAL) Set objAddressEntries = objAddressList.AddressEntries ... it fails with the erromessage: Object doesn't support this property or method: 'objSession.GetAddressList' Why oh why? |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Populate Form with Outlook Contact Data | Seagull Ng | Outlook - Using Contacts | 1 | March 1st 06 02:56 PM |
| Distribution Lists in Public Contact Folder | tgreco | Outlook - Using Contacts | 0 | February 1st 06 02:51 PM |
| Populate Company field from Contact field in custom task form | Sue Mosher [MVP-Outlook] | Outlook - Using Forms | 0 | January 20th 06 08:37 PM |
| export a public contact folder to excel? | mjb | Outlook - Using Contacts | 1 | January 20th 06 06:44 AM |
| journal entries on public contact folder | Melissa m | Outlook - Using Contacts | 3 | January 18th 06 04:26 PM |