Quantcast
Channel: Word for Developers forum
Viewing all articles
Browse latest Browse all 4350

Word 2013 and Active Directory attribut

$
0
0

Hi,

I'm working with WS2008R2 SP1 AD and Office standard 2013 and W7 SP1 x64. Our compagny wants to create .dotm/.dotx with automatic fields.

For example, we want that when a user opens a .dotx his name appears automatically. This one is easy it's the {AUTHOR \*MERGEFORMAT}.

But What we want to do is to do the same for the:

- street adress

- email adress

- the job title

All informations are in our Active Directory, but it seems that Word does not read directly the Active Directory info but some cached info on the computer.

So, is there a way or workaround to create some .dotx with the possibility to extrat some AD fields attribut attached with some user and at the end to build a semi automatic doc with the information of the user who has open this .dotx/.dotm?

So far, clues say that I have to write some vba script and 2 kind of solution/workaround:

The first lead is:

To retrieve the user account properties from Active Directory, we have to turn to some VBA scripts, no way to achieve this via any built-in features.

As far as I know, you can bind to the user account object by using the GetObject function and the LDAP provider.

Then use the GetInfo method to initialize the local cache with attributes of the user account object. This step will ensure that the most up-to-date attribute values of the ADSI object are retrieved.

For example:

Set objUser = GetObject _
("LDAP://...")
objUser.GetInfo

If you want to get this attributes when you create a new document based on a template (.dotx/.dotm), you'll need to use the AutoNew macro.

the second lead is:

http://heureuxoli.developpez.com/office/word/creermodele/#L2-G

Thank you in advance for any king od answer.

best regards



Viewing all articles
Browse latest Browse all 4350

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>