我正在尝试从active Directory中检索thumbnailPhoto属性,将其转换为Base64,然后使用它更新Salesforce中的字段。但是从下面的图片中可以看到,找不到该图片:
这是我的代码:
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);
}
不知道我在做什么错...