locked
Word 2013 and Active Directory attribut RRS feed

  • Question

  • 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 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?

    Thank you in advance.
    Thursday, January 22, 2015 9:27 AM

Answers

  • 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?

    Thank you in advance.

    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.

    I'm personally not familiar with this, cannot provide you the complete scripts here. And here we only discuss questions and feedback for Microsoft Office client, for further assistance, I would suggest you post in the dedicated forum of Word for Developer:

    https://social.msdn.microsoft.com/Forums/office/en-US/home?forum=worddev

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.

    Regards,

    Ethan Hua
    TechNet Community Support


    It's recommended to download and install Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office programs.

    Sunday, January 25, 2015 8:25 AM

All replies

  • 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?

    Thank you in advance.

    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.

    I'm personally not familiar with this, cannot provide you the complete scripts here. And here we only discuss questions and feedback for Microsoft Office client, for further assistance, I would suggest you post in the dedicated forum of Word for Developer:

    https://social.msdn.microsoft.com/Forums/office/en-US/home?forum=worddev

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.

    Regards,

    Ethan Hua
    TechNet Community Support


    It's recommended to download and install Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office programs.

    Sunday, January 25, 2015 8:25 AM
  • Hi Ethan,

    Thank you for you answer, this lead is promissing, I will search about the AutoMacro.

    Thank you again !

    Wednesday, January 28, 2015 10:10 AM
  • I place such information in AutoText (building blocks) stored in a .dotx file which is loaded as a Global Template. The contents of that template can be changed for different users and or offices. You can use one template for regional information, a different one to hold office information, and a third to hold user information.

    The information is imported into documents with AutoText fields in the templates.

    I discussed this more under AutoText in Automated Boilerplate Using Microsoft Word. See the part about using AutoText in Templates with Fields. There is also a brief discussion in the Fields chapter.


    Charles Kenyon Madison, WI






    • Edited by Charles Kenyon Wednesday, January 28, 2015 3:37 PM Make link more specific
    Wednesday, January 28, 2015 2:56 PM