This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal


May 11, 2015, 7:11 PM
13 Posts

Trying to download

  • Category: Domino Designer
  • Platform: Windows
  • Release: 9.0.1
  • Role: Developer
  • Tags: ibm_notes,photos,active_directory,lotusscript
  • Replies: 8

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?

May 11, 2015, 7:31 PM
11 Posts
Found something on MS Technet Forum that may help you
Hello Hogne,

This is what I found:

https://social.technet.microsoft.com/Forums/scriptcenter/en-US/1fac22c6-536f-4b4f-a272-79f10642990e/help-stuck-with-vbs-ad-query-that-save-files-from-thumbnailphoto-into-bmp-file-it-doesnt-go-threw?forum=ITCG

It seems (mainly on the responses to that topic) that downloading the photo is an option. When you have it on a file system, you may attach it to a Notes document using a LotusScript.


I think it would be easier if there was a way to publish the photo directly from AD using HTTP... maybe there is a plugin on IIS that you could use for it. Then I think it would not be so difficult to place the URL to the photo on a Notes document, maybe on a <image> HTML tag.

HTH. Regards,

Edson Luis Almeida Viana

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal