Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
Grant Mantle Grant  Mantle is offline
external usenet poster
 
Posts: 1
Default showing Active Directory fields within MS Word

Hello,

Me, MS Word and coding are trouble at the best of time. I have a
request and am hoping you might be able to help me out.
I am wanting to suck out some data from our Active Directory and put in
to word if possible.

QUESTION 1: When person logs on to a workstation within the domain;
fields such as username, full name and email properties are attached
right?? - I hope so...

QUESTION 2: How does one get the fields (i.e. email address, username
and fullname) on to a word document? - the reason I ask is because I
have been assigned the task to create a template so the user just has
to type the message within the template and ideally not have to fill in
any particulars regarding to Full Name, email address etc...

QUESTION 3: Am I going about this all the wrong way? - is there an
alternative?

Many thanks in advance,

Grant

  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Jay Freedman Jay Freedman is offline
external usenet poster
 
Posts: 9,854
Default showing Active Directory fields within MS Word

On 3 Dec 2006 18:41:41 -0800, "Grant Mantle"
wrote:

Hello,

Me, MS Word and coding are trouble at the best of time. I have a
request and am hoping you might be able to help me out.
I am wanting to suck out some data from our Active Directory and put in
to word if possible.

QUESTION 1: When person logs on to a workstation within the domain;
fields such as username, full name and email properties are attached
right?? - I hope so...


Not exactly, but the effect is the same. You can get the login name of
the current user by calling a function in the operating system of the
local machine. The code is at
http://www.word.mvps.org/FAQs/Macros...urUserName.htm. For all
the other stuff, you have to contact the Active Directory, using
something called LDAP (Lightweight Directory Access Protocol). To do
this you write code that uses Active Directory Service Interfaces
(ADSI).

You can do this stuff from inside a VBA macro in Word. When you start
chasing down the documentation, most of the examples will be in
VBScript, but you can usually just paste it into a VBA macro and it
works. The main difference is that you don't use WScript.Echo for
output -- if you want to see output, replace WScript.Echo with
Debug.Print and open the Immediate Window of the VBA editor.


QUESTION 2: How does one get the fields (i.e. email address, username
and fullname) on to a word document? - the reason I ask is because I
have been assigned the task to create a template so the user just has
to type the message within the template and ideally not have to fill in
any particulars regarding to Full Name, email address etc...


There's an ADSI primer starting at
http://www.microsoft.com/technet/scr....mspx?mfr=true
that will show you, in particular, how to read properties of ADSI
objects. You'll need to know the full name of the domain that contains
the Active Directory; the primer's examples use the made-up domain
na.fabrikam.com.


QUESTION 3: Am I going about this all the wrong way? - is there an
alternative?


No alternative unless you want to write your own directory service
from scratch. :-)

Many thanks in advance,

Grant


--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
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
Word should catalog misspelled words to study. rndthought Microsoft Word Help 39 May 21st 23 02:47 AM
How to put graphics on envelopes? Steve Koenig Microsoft Word Help 21 April 29th 23 02:47 AM
Change paper size; Word changes to invalid margins OhioTech New Users 10 July 6th 06 02:00 PM
hard space between words. Sandy L Microsoft Word Help 7 May 5th 06 08:25 PM
In Word, how can I see all files (*.*) in "save as"? citizen53 New Users 8 April 4th 05 04:56 PM


All times are GMT +1. The time now is 08:07 AM.

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"