Documents for QlikView related information.
I recently tried to import user pictures from Microsoft Active Directory to personalize a QV application (logged on users should see their AD picture).
While doing so, I encountered a problem importing and converting the thumbnailPhoto active directory attribute.
ThumbnailPhoto in this case contains a user picture (JPG) coded as an octet string.
Unlike the expected string length of some kB I only got a string length of 4003 bytes leading to a corrupt jpg file as most of the information was missing.
Nevertheless I tried to import this picture and decided to work on the string length issue later on.
As I could not load the picture ressource directly from the string, I previously saved it to disk.
The conversion and saving was done using vbs.
Here are the load script and vbs function:
OLEDB CONNECT32 TO [Provider=ADsDSOObject;Encrypt Password=False;Integrated Security=SSPI;Data Source=<ADserverName>;Mode=Read;Bind Flags=0;ADSI Flag=-2147483648];
len(thumbnailPhoto) as LenThumbnailPhoto,
sAMAccountName = '<useraccount>';
OctetStringToFile(thumbnailPhoto, 'C:\temp\'&sAMAccountName&'.jpg') as ResultOctetStringToFile
DROP Table tabTemp;
Bundle Info LOAD
Function OctetStringToFile(OctetString, FilePath)
Const adTypeText = 2
Const adSaveCreateOverWrite = 2
LenData = Len(OctetString)\2 + Len(OctetString) Mod 2
set fso = createobject("scripting.filesystemobject")
set stream = createobject("adodb.stream")
stream.type = adTypeText
stream.charset = "windows-1252"
For i = 0 to LenData-1
stream.writetext chr(CByte("&h" & Mid(OctetString, i*2+1, 2)))
stream.savetofile FilePath, adSaveCreateOverWrite
OctetStringToFile = "processed"
Any ideas as to why the thumbnailPhoto attribute octet string is truncated or whether there is a more straight forward approach for this picture ressource import?
thanks in advance
Hello I've just found your question and it was awaile ago!
I had similar issue recently and after digging in I found that the LDAP interrogation I have found that SQL interrogation truncates volume of the data that why I have partial pictures,
You need to use some different approach using macros and Micrsofot interface.