How to access the Outlook Address book from Word for mail merging

T

thomasv

Hi,
I would like to access the Outlook 2003 global Address book from Word 2003
to be able to do some mail merging. When I use the mail merge wizard, I can
though just use Contacts from Outlook, not the global Address book.

Is there thus any way to access the global Address book for mail merging,
either from Word or from Outlook?

Copying all info from Address book to Contacts would probably not be a good
option, we have 5000 - 15000 contacts, haven't though counted them...

Thomas
 
T

thomasv

Thanks!
I recently found this feature myself, but as I understand the instructions,
it is the Contacts that is used, and not the Global address book that I need.
To access this Global address book, I click the "book" icon in Outlook 2003,
and on the right is already chosen Global Address List in the field "Show
Names from the:"
In this my company have a list of approx. 18000 names...
 
D

Doug Robbins - Word MVP

You could select all of the names in the Global Address list (select the
first, then move to the end of the list and hold down the Shift key and left
click) then right click as select Add to Contacts.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
P

Peter Jamieson

I think this is pretty unlikely to work, but you can try it anyway (it works
here, but I can think of several reasons why it would not - primarily
security-related).

Create a folder (say c:\a)

Create an Access .mdb called gal.mdb in there.

Don't have Access? Then you can create a .mdb in Word as follows:
a. Start the Mail Merge Wizard, get to the point where you select a data
source, then select "Type a new List" and click Create.
b. type one letter into the Title field in the form, delete the letter,
then click Close. Click Save in the dialog box that appears. Save the file
with name gal.mdb in the usual way.

Find out the name of the Outlook Profile you are using. I think you should
be able to do this by going into Windows Control Panel->Mail->Show Profiles

As far as I know, the default in Office 2003 is "Outlook", but it isn't
something I know a lot about.

Open Notepad and copy the following text into it, starting with the <html>
line and ending with </html>

<html>
<head>
<meta http-equiv=Content-Type content="text/x-ms-odc; charset=utf-8">
<meta name=ProgId content=ODC.Table>
<meta name=SourceType content=OLEDB>
<meta name=Table content="Global Address List">
<xml id=docprops></xml><xml id=msodc><odc:OfficeDataConnection
xmlns:eek:dc="urn:schemas-microsoft-com:eek:ffice:eek:dc"
xmlns="http://www.w3.org/TR/REC-html40">
<odc:Connection odc:Type="OLEDB">
<odc:ConnectionString>Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\a\gal.mdb;Mode=Share Deny None;Extended Properties=&quot;Exchange
4.0;PROFILE=Outlook;TABLETYPE=1;TABLENAME=Global Address List;&quot;;Jet
OLEDB:Engine Type=48;</odc:ConnectionString>
<odc:CommandType>Table</odc:CommandType>
<odc:CommandText>Global Address List</odc:CommandText>
</odc:Connection>
</odc:OfficeDataConnection>
</xml>
</html>

If your Access database isn't called c:\a\gal.mdb, modify the Data Source=
value accordingly.
If your Outlook profile isn't called "Outlook", modify the PROFILE= value
accordingly.

Save the file as (say) gal.odc in your "My Data Sources" folder

Create a new mail merge main document. When you select the data source,
choose gal.odc.

I would be interested to know if that works for you.

Even if does, I would use this approach with caution. If it doesn't work,
sorry, but I doubt very much that I will be able to work out why!

Incidentally, a .odc file normally has quite a lot more stuff in it. It
isn't needed to connect Word to a data source, but it does have its uses if,
for example, you want to inspect the data source using Internet Explorer.
 
P

Peter Jamieson

NB, there should be a </body> line in that chunk of code, i.e. the end of it
should look like

</xml>
</body>
</html>

(Word does not appear to care but there you go).
 
T

thomasv

Thanks Peter,

I haven't tried this yet, but will later on. As our organization has a quite
rigid security setup, it may though not function. If it does, we would also
somehow have to deploy it to tens of users.

Is it thus not possible to easy have direct access to the Global address
list from Word?

Thomas
 
P

Peter Jamieson

Is it thus not possible to easy have direct access to the Global address
list from Word?

Not as far as I know. People ask about it from time to time. The reality is
that Word does not have very good access to address data in general -
although I think we can assume that this is /now/ deliberate security policy
to prevent address data from being too easily accessed, earlier it may have
been an accidental consequence of the fact that MAPI data is hard to get at.
Similarly, although you /can/ get at Outlook contact data from Word, the
process uses an unmaintained approach and it is usually far better to start
from Outlook.

In essence, Word gets data from Outlook and Address books using the Jet
(Access) ODBC driver/OLE DB provider, which can work with data from a number
of different types of data source using plugins called IISAMs (there's one
for Excel, one for dBASE, and so on). As far as I can tell, the
Outlook/Exchange IISAM may have been dropped altogether from Jet's Office
2007 successor, ACE (although you still seem to be able to get at this data
on Office 2007 systems using Jet).

Previously, I'd never been able to work out a way to get Word to work
"directly" with this IISAM. The best I could do was to create an Access
database and create a linked table to the GAL, and possibly a query to
retrieve all the rows from that table. That's also an approach that you can
consider, particularly since you may need a query to select "real" address
data (the GAL also contains account data for Windows domain administrative
accounts etc. - i.e. not human users). So I was a bit surprised to make a
..odc that actually works.
 
T

thomasv

Well, I have Office 2003 so thay maybe explains why I did get some access.
One thing I don't understand is why I can access GAL when using the Evelopes
& labels wizard, but not when using mail merge.
We do have Sharepoint, InfoPath and a lot of other MS systems in the house,
so perhaps by using them instead, we'd be able to get GAL data into forms or
Word documents.

Thanks a lot Peter, I really appreciate your help!

Thomas
 
D

Doug Robbins - Word MVP

Hi Peter,

When I tried this, I received an error message about the Installable ISAM
not being available - Using Word 2003 on Windows XP. As this was on a
corporate computer, the build may have omitted the ISAM. Unfortunately, it
would be imprudent of me to make any enquiries about that.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
P

Peter Jamieson

One thing I don't understand is why I can access GAL when using the
Evelopes
& labels wizard, but not when using mail merge.

The reason you can get GAL info there is simply because Word actually pops
up the "Address Book" user interface which lets you get at any MAPI address
books including the GAL and Outlook Folders marked as being in the Outlook
Address Book. OK, that's not much of an "explanation", but for example from
a security point of view that may be regarded as reasonably safe because
(AFAIK) you can't easily use tha dialog to extract a whole bunch of
addresses programmatically.
We do have Sharepoint, InfoPath and a lot of other MS systems in the
house,
so perhaps by using them instead, we'd be able to get GAL data into forms
or
Word documents.

Yes, to me it all boils down to "should a user have access to the data Y/N"
and once they have access, you have to accept that they can do anything they
want with the data they are allowed to see. I suppose MS tried to solve in
Outlook by having dialogs pop-up that only allow you access to contacts etc.
for a limited period, but it's never going to be an easy problem to solve.
Avoiding creating solutions that store copies of the data on client PCs is
probably the best most people are going to manage, and even avoiding that is
probably not easy.

FWIW the Access linked table approach I mentioned is probably a workable
client-side solution, as long as every user has the same Outlook (MAPI)
Profile name - you /should/ be able to set up the .mdb on one system and
copy it to one that does not have access, but I may be wrong about that.

The other approach I would probably favour if you have SQL Server is to find
a way to get SQL Server to get the data, preferably "on demand". That way,
you still get good user access controls, the data is still only stored
deliberately on your server systems, and Word can use that data (but it
needs a .odc, .dsn, machine DSN or .udl to do it). Not that I have any idea
on feasibility.
 
P

Peter Jamieson

Hi Doug,
corporate computer, the build may have omitted the ISAM.

That sounds quite likely - I can't remember what causes this IISAM to be
installed (it could be something in Office SETUP, Outlook SETUP, Access
SETUP, installing the Jet addon for the MDAC, or possibly even something
that gets installed when you connect a workstation to a Domain with an
Exchange server)
 

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