I have a Typescript SPA using ArcGIS JS Api 4.9. When I query the layer for attachments I receive a attachment info array with the correct values. When I try and display the items in the array I receive undefined?
if (layer.capabilities.data.supportsAttachment) {
const attachmentQuery = {
objectIds: feature.getAttribute('OBJECTID')
};
layer.queryAttachments(attachmentQuery).then((attachmentInfos: esri.AttachmentInfo[]) => {
console.log('Attachment infos: ', attachmentInfos);
console.log('Attachment 0: ', attachmentInfos[0]);
for (let index = 0; index < attachmentInfos.length; index++) {
const element = attachmentInfos[index];
console.log('Element: ', element);
}
attachmentInfos.forEach((attachment) => {
console.log('Attachment: ', attachment.contentType);
});
});
}