Question : Thumbnail Photo on Exchange 2007

Hello,

I'm just wondering if this is possible on Exchange 2k7

http://msexchangeteam.com/archive/2010/03/10/454223.aspx

I can't seem to get it working.

Answer : Thumbnail Photo on Exchange 2007

just as followup the script I linked to uses the jpegphoto  attribute you are better off changing this to thumbnailphoto

here is an updated version taken from the link you provided
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
-------------------
'Photos must be less than 10kb
Const ForReading = 1
InDir = "C:\Temp\StaffPhotos"
Set fso = CreateObject("Scripting.FileSystemObject")
set oIADS = GetObject("LDAP://RootDSE")
strDefaultNC = oIADS.Get("defaultnamingcontext")
Set theConn = CreateObject("ADODB.Connection")
theConn.Provider = "ADsDSOObject"
theConn.Open "ADs Provider"
Set theCmd  = CreateObject("ADODB.Command")
theCmd.ActiveConnection = theConn
Set objRecordSet = CreateObject("ADODB.Recordset")
For Each tFile In fso.GetFolder(InDir).Files
   tName = tFile.Name
   'Gets the persons Name from the file by stripping the extention.
   tName = Left(tName, InStrRev(tName,".")-1)
   'You may need to tweak this bit depending on your naming conventions.
   strQuery = "<LDAP://" & strDefaultNC & ">;" & _
                             "(&(objectClass=person)(name=" & tName & "));name,adspath;subtree"
   theCmd.CommandText = strQuery
   Set objRS = theCmd.Execute
   If objRS.RecordCount = 0 Then
     MsgBox "Can't find account for " & tName
   Else
     Set objUser = GetObject(objRS("adspath"))
     ObjUser.Put "thumbnailPhoto", ReadByteArray(tFile.Path)
     ObjUser.SetInfo
   End If
Next
'Stolen from http://www.ericphelps.com/q193998/index.htm
Function ReadByteArray(strFileName)
   Const adTypeBinary = 1
   Dim bin
   Set bin = CreateObject("ADODB.Stream")
   bin.Type = adTypeBinary
   bin.Open
   bin.LoadFromFile strFileName
   ReadByteArray = bin.Read
End Function
Random Solutions  
 
programming4us programming4us