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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Looking for Code to link an Outlook Address Book
Hello,
I'm looking for code that will link an Outlook Address Book to my database. I want to use code so that it will check and link to the address book everytime the db is open, if the link is not there it will add it. Shane |
#2
|
|||
|
|||
Looking for Code to link an Outlook Address Book
File - Get External Data - Link Tables. Pick Files of Type - Exchange (or
Outlook as appropriate) " wrote: Hello, I'm looking for code that will link an Outlook Address Book to my database. I want to use code so that it will check and link to the address book everytime the db is open, if the link is not there it will add it. Shane |
#3
|
|||
|
|||
Looking for Code to link an Outlook Address Book
That is not code, my friend!
I want to be able to automate the process. Shane Brian wrote: File - Get External Data - Link Tables. Pick Files of Type - Exchange (or Outlook as appropriate) " wrote: Hello, I'm looking for code that will link an Outlook Address Book to my database. I want to use code so that it will check and link to the address book everytime the db is open, if the link is not there it will add it. Shane |
#4
|
|||
|
|||
Looking for Code to link an Outlook Address Book
Hmmm....sorry. I guess I missed the part about the need to dynamically open
different address books. If it is a link to a static address book, then that would do it. If it is not, it is not as simple as establishing a link; there are parameters that must need to be provided by the user at runtime (which can be done via a browse window). That is, the connect string for a linked address book or contact list looks like this: Outlook 9.0;MAPILEVEL=Personal Folders|;PROFILE=Outlook;TABLETYPE=0;TABLENAME=Con tacts;DATABASE=C:\DOCUME~1\User\LOCALS~1\Temp\;TAB LE=Contacts You will see that the version of Outlook, the MAPI type (Personal Folders or Address Book), Profile name, Table (Outlook folder) name are all embedded. If you know the Outlook version, MAPI profile name, contact folder name, and User name beforehand, it is an easy thing to update the linked table's connect string. However, if a user opens the app on a PC having a different version of Outlook, the Outlook 9.0 may be Outlook 8.0, or the MAPI profile name may differ. Thus, we need to: 1. Create the linked table once manually (can be done programmatically, but I think this is easier done manually) 2. Test for a valid connection to the linked table when opening the app (e.g. count the records in the linked table and anticipate the error that will occur if the connection is not valid) 3. On Error, allow user to browse for a MAPI contact folder and then 4. Store the connect string. Well, I had time to get part of #3 and will work on more later if I have time and no MVP's get you a better answer in the meantime. This should at least get you started. Dim ol As Object 'Outlook Dim olns As Object 'Outlook namespace Dim cf As Object 'contacts folder Dim c As Object Dim Prop As Object Set ol = CreateObject("Outlook.Application") Set olns = ol.GetNamespace("MAPI") Set cf = olns.PickFolder This gets you as far as browsing for the folder. Play around with it, and I will see if I can extract the Outlook version, etc. from the properties of one of the objects so that you can update the connect string. "shanej" wrote: That is not code, my friend! I want to be able to automate the process. Shane Brian wrote: File - Get External Data - Link Tables. Pick Files of Type - Exchange (or Outlook as appropriate) " wrote: Hello, I'm looking for code that will link an Outlook Address Book to my database. I want to use code so that it will check and link to the address book everytime the db is open, if the link is not there it will add it. Shane |
#5
|
|||
|
|||
Looking for Code to link an Outlook Address Book
Thanks for all your help! I look forward to seeing what you come up
with next. Shane Brian wrote: Hmmm....sorry. I guess I missed the part about the need to dynamically open different address books. If it is a link to a static address book, then that would do it. If it is not, it is not as simple as establishing a link; there are parameters that must need to be provided by the user at runtime (which can be done via a browse window). That is, the connect string for a linked address book or contact list looks like this: Outlook 9.0;MAPILEVEL=Personal Folders|;PROFILE=Outlook;TABLETYPE=0;TABLENAME=Con tacts;DATABASE=C:\DOCUME~1\User\LOCALS~1\Temp\;TAB LE=Contacts You will see that the version of Outlook, the MAPI type (Personal Folders or Address Book), Profile name, Table (Outlook folder) name are all embedded. If you know the Outlook version, MAPI profile name, contact folder name, and User name beforehand, it is an easy thing to update the linked table's connect string. However, if a user opens the app on a PC having a different version of Outlook, the Outlook 9.0 may be Outlook 8.0, or the MAPI profile name may differ. Thus, we need to: 1. Create the linked table once manually (can be done programmatically, but I think this is easier done manually) 2. Test for a valid connection to the linked table when opening the app (e.g. count the records in the linked table and anticipate the error that will occur if the connection is not valid) 3. On Error, allow user to browse for a MAPI contact folder and then 4. Store the connect string. Well, I had time to get part of #3 and will work on more later if I have time and no MVP's get you a better answer in the meantime. This should at least get you started. Dim ol As Object 'Outlook Dim olns As Object 'Outlook namespace Dim cf As Object 'contacts folder Dim c As Object Dim Prop As Object Set ol = CreateObject("Outlook.Application") Set olns = ol.GetNamespace("MAPI") Set cf = olns.PickFolder This gets you as far as browsing for the folder. Play around with it, and I will see if I can extract the Outlook version, etc. from the properties of one of the objects so that you can update the connect string. "shanej" wrote: That is not code, my friend! I want to be able to automate the process. Shane Brian wrote: File - Get External Data - Link Tables. Pick Files of Type - Exchange (or Outlook as appropriate) " wrote: Hello, I'm looking for code that will link an Outlook Address Book to my database. I want to use code so that it will check and link to the address book everytime the db is open, if the link is not there it will add it. Shane |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Contacts & Outlook address book | Milrite | Installation & Setup | 13 | March 8th, 2007 09:06 PM |
2 contacts folders | Larry Tackett | Contacts | 21 | October 21st, 2005 12:45 PM |
How to delete duplicate contacts folders in Office XP? | Robert O'Connell | Contacts | 18 | October 6th, 2005 11:43 PM |
Outlook Address Book Help | Tom Saundry | General Discussion | 2 | August 22nd, 2005 05:24 AM |
Sorting address book in Outlook 2002 | Scott | Contacts | 10 | June 7th, 2004 11:46 PM |