AnsweredAssumed Answered

ArcGIS JS Api 4.9 attachments not displaying

Question asked by PGiard@chacompanies.com on Nov 5, 2018
Latest reply on Nov 6, 2018 by ubatsukh-esristaff

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);

});
});
}

 

 

The above code produces:

  1. Attachment infos: [object Object]
  2. Attachment 0: undefined

Outcomes