Sign in to follow this  
Followers 0
Bodman

using _AD_GetObjectsInOU with _ArrayToString

8 posts in this topic

Can anyone help, I am trying to export the telephone numbers for a list of users in AD using _AD_GetObjectsInOU

I can get the list to export to a array, but I cant get the info from the array into a string. Can you see where im going wrong.

#include <ad.au3>

_AD_Open()

Global $sOU = "OU=Users,OU=C3048090,OU=SKE,OU=GB,OU=EU,DC=ecdomain,DC=net"

Global $aResult = _AD_GetObjectsInOU($sOU,"(&(objectCategory=person)(objectClass=user)(mail=*))",2,"telephoneNumber,samAccountName")

_ArrayDisplay($aResult)

MsgBox(0, "_ArrayToString()", _ArrayToString($aResult))


_AD_Close()

Thanks

Bod

Share this post


Link to post
Share on other sites



_AD_GetObjectsInOU returns a 2-dimensional array, _ArrayToString can only handle 1-dimensional arrays.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

_AD_GetObjectsInOU returns a 2-dimensional array, _ArrayToString can only handle 1-dimensional arrays.

:) thanks for your reply.....is there anyway I can export a users phone number to a string then

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

You directly access the element in the array.

$aResult[1][0] is the telephoneNumber of the first user, $aResult[1][1] is samAccountName and so on ...

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

You directly access the element in the array.

$aResult[1][0] is the telephoneNumber of the first user, $aResult[1][1] is samAccountName and so on ...

do you mean like this

MsgBox(0, "_ArrayToString()", _ArrayToString($aResult[1][0]))

as im still getting a blank...sorry arrays confuse the hell out of me

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Try

MsgBox(0, "_ArrayToString()", $aResult[1][0])

The content of an array element is always a string.

To understand how arrays work please have a look here.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Try

MsgBox(0, "_ArrayToString()", $aResult[1][0])

The content of an array element is always a string.

To understand how arrays work please have a look here.

Thank you Ive spent ages banging my head with this. I really appreciate your help (again)

Bod

Share this post


Link to post
Share on other sites
:)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0