Hi, Edson.
Thanks for your reply.
Sorry for not being clear about this, but I am actually trying to download it from AD, and then attach it to the Notes/Document. I was hoping this could be done when getting all the other data about the user from AD.
Here's my code:
Set dbCurrent = s.Currentdatabase
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Open "Provider=ADsDSOObject;"
'test = objConnection.DefaultDatabase
Set objCommand = CreateObject("ADODB.Command")
Set objCommand.ActiveConnection = objConnection
strLdapFilter = "Select sn, givenName, mail, telephoneNumber, mobile, department, employeeID, manager, thumbNailPhoto, sAMAccountName FROM 'LDAP://ou=" & strDepartment & ",ou=Users and Groups,ou=<town>,dc=<domain>,dc=com' WHERE objectCategory='person' AND objectClass='user'"
objCommand.CommandText = strLdapFilter
Set objRecordSet = objCommand.Execute
If objRecordSet.RecordCount = 0 Then
MsgBox "No groups found!"
Else
While Not objRecordset.EOF
Set docPerson = dbCurrent.Createdocument()
docPerson.Form = "frmEmployee"
docPerson.sn= objRecordset.Fields("sn").value
docPerson.givenName = objRecordset.Fields("givenName").value
docPerson.department = objRecordset.Fields("department").value
docPerson.telephonenumber = objRecordset.Fields("telephoneNumber").value
docPerson.mobile = objRecordset.Fields("mobile").value
docPerson.mail = objRecordset.Fields("mail").value
Here is where I'm trying to get hold of the photo, and attach it to the Notes Document:
'Set rtItem = New NotesRichTextItem(docPerson, "thumbNailPhoto")
'Set object = rtItem.EmbedObject(EMBED_OBJECT, "", objRecordset.Fields("thumbNailPhoto"))
The above didn't work, so I then tried this:
Dim filenum As Integer
Dim filename As String
Dim varPhoto As Variant
Set varPhoto = objRecordset.Fields("thumbNailPhoto")
filename = "C:\user_icons\test.jpg" ' & objRecordset.Fields("sAMAccountName").value
filenum% = FreeFile()
Open filename For Binary Access Write As fileNum%
'Put #filenum%, , varPhoto
Put #filenum%, , filenum
Close filenum%
Call docPerson.Save(True,False,True)
objRecordset.MoveNext
Wend
No dice so far. Any ideas? Is it even possible?