Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Mike Mike is offline
external usenet poster
 
Posts: 229
Default Mail merge and Active Directory

I would like to setup word 2007 to use Active Directory objects for a mail
merge.

Winthin word, select recipients, I have started to create a data connection
using the "OLE DB proider for Microsoft Directory Services" but cannot get it
to work and have not managed to find any documentation with regard what to
put in the Data Source or location fields in the setup wizard.

  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Mail merge and Active Directory

This is my post from a couple of years ago on this subject - I can't say
I've looked at this area since then:

------------------------------
The last time I looked (about 2 years ago) it was possible to use the OLEDB
provider for the AD to use AD as a Word mailmerge data source. e.g. in code

ActiveDocument.MailMerge,OpenDataSource _
Name:="c:\a\empty.odc", _
Connection:="Provider=ADSDSOObject;", _
SQLStatement:="SELECT * FROM 'LDAP://adsiservername'"


where empty.odc is a completely empty file that you can create in e.g.
Notepad, and adsiservername is the name of the adsi server box.


However, I get the impression that what you want to do is either
a. get some ADSI data corresponding to the individual/login name of the
person doing the merge or
b. get some ADSI data appropriate to the data in each row in another data
source.


Either way, for the data to appear as a field in the data source, you would
have to be able to get the data source to do the ADSI query. If your data
source is Jet/Access, you /might/ be able to create a Query that could do
that, using a linked table perhaps - I don't know off the top of my head. If
your data source is something like SQL Server, you /might/ be able to do the
same using an attached table and a View.


Otherwise, if it's case (a), you could consider getting the data using ADO
in a Word VBA macro each time a merge is done, and either inserting the
results directly or storing them in a way that makes insertion relatively
simple, e.g. in a Document Property (insert using { DOCPROPERTY } field or
Document Variable (insert using { DOCVARIABLE } field.
------------------------------



--
Peter Jamieson
http://tips.pjmsn.me.uk

"Mike" wrote in message
...
I would like to setup word 2007 to use Active Directory objects for a mail
merge.

Winthin word, select recipients, I have started to create a data
connection
using the "OLE DB proider for Microsoft Directory Services" but cannot get
it
to work and have not managed to find any documentation with regard what to
put in the Data Source or location fields in the setup wizard.


  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Mike Mike is offline
external usenet poster
 
Posts: 229
Default Mail merge and Active Directory

Hi James,

Thanks for the reply.

I have sucessfully connected to AD before within scripts using the sort of
syntax you use below, but this time I am using the wizards within word 2007,
and my aim is for users to interactivly undertake a mail merge using Active
directory as the source of contacts rather than a public folder in Exchange.

Within word I am undertaking the following:
* Mailings tab.
* Select recipients option.
* Use existing list.
* click on "+Connect to new Data Source.odc"
* click on "other/advanced".
* select "OLE DB Provider for Microsoft Directory services".
* press next to get to the Connections page of "Data link properties".

Its on this page I cannot config the correct options for Data Source and
Location.

Cheers.
Mike.

"Peter Jamieson" wrote:

This is my post from a couple of years ago on this subject - I can't say
I've looked at this area since then:

------------------------------
The last time I looked (about 2 years ago) it was possible to use the OLEDB
provider for the AD to use AD as a Word mailmerge data source. e.g. in code

ActiveDocument.MailMerge,OpenDataSource _
Name:="c:\a\empty.odc", _
Connection:="Provider=ADSDSOObject;", _
SQLStatement:="SELECT * FROM 'LDAP://adsiservername'"


where empty.odc is a completely empty file that you can create in e.g.
Notepad, and adsiservername is the name of the adsi server box.


However, I get the impression that what you want to do is either
a. get some ADSI data corresponding to the individual/login name of the
person doing the merge or
b. get some ADSI data appropriate to the data in each row in another data
source.


Either way, for the data to appear as a field in the data source, you would
have to be able to get the data source to do the ADSI query. If your data
source is Jet/Access, you /might/ be able to create a Query that could do
that, using a linked table perhaps - I don't know off the top of my head. If
your data source is something like SQL Server, you /might/ be able to do the
same using an attached table and a View.


Otherwise, if it's case (a), you could consider getting the data using ADO
in a Word VBA macro each time a merge is done, and either inserting the
results directly or storing them in a way that makes insertion relatively
simple, e.g. in a Document Property (insert using { DOCPROPERTY } field or
Document Variable (insert using { DOCVARIABLE } field.
------------------------------



--
Peter Jamieson
http://tips.pjmsn.me.uk

"Mike" wrote in message
...
I would like to setup word 2007 to use Active Directory objects for a mail
merge.

Winthin word, select recipients, I have started to create a data
connection
using the "OLE DB proider for Microsoft Directory Services" but cannot get
it
to work and have not managed to find any documentation with regard what to
put in the Data Source or location fields in the setup wizard.



  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Mail merge and Active Directory

I understand what you are trying to achieve but I do not know what should go
in those fields either, and it is also possible that nothing you put in
there will make Word connect to that data source. The trouble is I think
that both Word and Excel (which is usually a bit better at opening .odc type
files) expect one of several things to happen when they open a .odc, and
none of them does in this case. e.g. Word can open a .odc that specifies a
database /in the connection string/ but no table, but only if the data
source can then provide a list of available tables. Or Word can open a .odc
where a table is specified. But in this case, possibly because of the nature
of ADSI itself, you do not specify a particular directory via the connection
string, and the provider cannot provide a list of tables. Nor have I found
any way to specify "a table" in a way that works with either Word or Excel.

(That certainly does not mean that it is not do-able, but the syntax for
connecting to directories, both via LDAP and using MS's SQl dialect, is
obscure enough that it is difficult even to work out things that might
plausibly work).

So in any case, your users would have to be able to form an LDAP or SQL
query to query your directory. If they know how to do that, all you really
have to do is provide a bit of Word VBA that prompts for the query and
issues the OpenDataSource command that I've provided (except there's an
error in it - it should be

ActiveDocument.MailMerge.OpenDataSource _
Name:="c:\a\empty.odc", _
Connection:="Provider=ADSDSOObject;", _
SQLStatement:="SELECT * FROM 'LDAP://the name of your ADSI server'"

).

--
Peter Jamieson
http://tips.pjmsn.me.uk

"Mike" wrote in message
...
Hi James,

Thanks for the reply.

I have sucessfully connected to AD before within scripts using the sort of
syntax you use below, but this time I am using the wizards within word
2007,
and my aim is for users to interactivly undertake a mail merge using
Active
directory as the source of contacts rather than a public folder in
Exchange.

Within word I am undertaking the following:
* Mailings tab.
* Select recipients option.
* Use existing list.
* click on "+Connect to new Data Source.odc"
* click on "other/advanced".
* select "OLE DB Provider for Microsoft Directory services".
* press next to get to the Connections page of "Data link properties".

Its on this page I cannot config the correct options for Data Source and
Location.

Cheers.
Mike.

"Peter Jamieson" wrote:

This is my post from a couple of years ago on this subject - I can't say
I've looked at this area since then:

------------------------------
The last time I looked (about 2 years ago) it was possible to use the
OLEDB
provider for the AD to use AD as a Word mailmerge data source. e.g. in
code

ActiveDocument.MailMerge,OpenDataSource _
Name:="c:\a\empty.odc", _
Connection:="Provider=ADSDSOObject;", _
SQLStatement:="SELECT * FROM 'LDAP://adsiservername'"


where empty.odc is a completely empty file that you can create in e.g.
Notepad, and adsiservername is the name of the adsi server box.


However, I get the impression that what you want to do is either
a. get some ADSI data corresponding to the individual/login name of the
person doing the merge or
b. get some ADSI data appropriate to the data in each row in another
data
source.


Either way, for the data to appear as a field in the data source, you
would
have to be able to get the data source to do the ADSI query. If your data
source is Jet/Access, you /might/ be able to create a Query that could do
that, using a linked table perhaps - I don't know off the top of my head.
If
your data source is something like SQL Server, you /might/ be able to do
the
same using an attached table and a View.


Otherwise, if it's case (a), you could consider getting the data using
ADO
in a Word VBA macro each time a merge is done, and either inserting the
results directly or storing them in a way that makes insertion relatively
simple, e.g. in a Document Property (insert using { DOCPROPERTY } field
or
Document Variable (insert using { DOCVARIABLE } field.
------------------------------



--
Peter Jamieson
http://tips.pjmsn.me.uk

"Mike" wrote in message
...
I would like to setup word 2007 to use Active Directory objects for a
mail
merge.

Winthin word, select recipients, I have started to create a data
connection
using the "OLE DB proider for Microsoft Directory Services" but cannot
get
it
to work and have not managed to find any documentation with regard what
to
put in the Data Source or location fields in the setup wizard.




Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
mail merge toolbar isn't active Lockhart Microsoft Word Help 1 May 20th 08 06:13 AM
my mail merge tool bar is not active in my mail merge file 547512 Microsoft Word Help 1 February 7th 06 06:50 AM
Integrating Active Directory in Word template Lasse Microsoft Word Help 0 December 20th 05 04:39 PM
Active Directory Information in Word XP [email protected] Mailmerge 0 November 8th 05 04:16 PM
How do I use a field in Active Directory, in a Word document? Gavin Whatrup Microsoft Word Help 0 September 19th 05 04:34 PM


All times are GMT +1. The time now is 10:00 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"