Я пытаюсь получить атрибут thumbnailPhoto из Active Directory, преобразовать его в 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);
}
Не знаю, что я делаю не так ...