LDAP using thumbnailphoto

Get help with using AutoHotkey and its commands and hotkeys
User avatar
thenasos
Posts: 79
Joined: 10 Nov 2015, 10:00

LDAP using thumbnailphoto

07 Mar 2017, 07:38

Hi,
Trying to get a photo from AD.
Field gets populated ( I assume), but not able to use it. (I get 1 object and type 203(adLongVarWChar) and nothing for value)
Need to use activex here maybe?

Code: Select all

objConnection := ComObjCreate("ADODB.Connection")
objCommand := ComObjCreate("ADODB.Command")
objRecordset := ComObjCreate("ADODB.Recordset")
strDomain := ComObjGet("LDAP://rootDSE").Get("defaultNamingContext")
objConnection.Open("Provider=ADsDSOObject;")
objCommand.ActiveConnection := objConnection
fieldList := "thumbnailPhoto"

objCommand.CommandText := "SELECT " fieldList " From 'LDAP://" strDomain "' WHERE SAMAccountName='SidNumber'"

objRecordset := objCommand.Execute()

;~ loop
;~ {
	;~ if (objRecordset.eof)
		;~ break
msgbox % objRecordset.Fields.Count " | " objRecordset.Fields.("thumbnailPhoto").type " | " objRecordset.Fields.("thumbnailPhoto").value

gui, add, picture,, % objRecordset.Fields.Item("thumbnailPhoto")
gui, show
Shrek is love...
User avatar
kczx3
Posts: 1163
Joined: 06 Oct 2015, 21:39

Re: LDAP using thumbnailphoto

07 Mar 2017, 19:11

You need to write the byte stream to a file first. See FileOpen and other associated functions

Return to “Ask For Help”

Who is online

Users browsing this forum: DaveT1, Rohwedder, RubbeH and 50 guests