如何从Active Directory检索图像?

我正在尝试从active Directory中检索thumbnailPhoto属性,将其转换为Base64,然后使用它更新Salesforce中的字段。但是从下面的图片中可以看到,找不到该图片:

如何从Active Directory检索图像?

这是我的代码:

 output_row.Id = input_row.Id;
 output_row.UserPhotoLoader__User_Photo_Blob__c = null;


 File file = new File("C:/Desktop/Studio/workspace/" + 
 input_row.thumbnailPhoto + ".jpg");


try {           
    FileInputStream imageInFile = new FileInputStream(file);
    byte imageData[] = new byte[(int)file.length()];
    imageInFile.read(imageData);
    imageInFile.close();

output_row.UserPhotoLoader__User_Photo_Blob__c = "<img alt=\"" + input_row.Name + "\" src=\"data:image/jpeg;base64," +
                        new String(Base64.encodeBase64(imageData)) +
                        "\"></img>";

System.out.println("+++ Conversion réussie pour " + input_row.Name);
} catch (FileNotFoundException e) {
System.out.println("*** Image non trouvée pour " + input_row.Name + "\n" + e);
} catch (IOException ioe) {
System.out.println("*** Erreur de lecture de l'image " + input_row.Name + "\n" + ioe);
}

不知道我在做什么错...

gaoy969 回答:如何从Active Directory检索图像?

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3144197.html

大家都在问