Kentico API - GetAttachments method does not send binary data

Cristhian Caldas asked on February 1, 2016 19:14

Hi:

I was using the API for trying to invoke the method DocumentHelper.GetAttachments to get the attachment info with the binary data:

DocumentHelper.GetAttachments( node, where, orderBy, true, tree);

but when i checked the column "AttachmentBinary" , it appeared empty ,also i was validating in CMS that the document has the attachment and it´s ok ; so i would like to know if exists another API method to get the binary data of a document's attachment or it must to configure some permissions on CMS to get the binary data when i invoke the mentionated method.

Thanks

Recent Answers


Roman Hutnyk answered on February 1, 2016 20:27

Age you trying go get attachment sitting in page field, od those sitting in Page -> Properties -> Attachments?

0 votesVote for this answer Mark as a Correct answer

Cristhian Caldas answered on February 1, 2016 21:14

I'm just trying to get the binary data attachment of a "CMS.File" document-type using the API.

0 votesVote for this answer Mark as a Correct answer

Roman Hutnyk answered on February 1, 2016 21:42

Try to grab FileAttacment value from CMS.File and use following code to get the attachment object, where you should be able to find binaries:

DocumentHelper.GetAttachment(guid, tree, siteName);

1 votesVote for this answer Mark as a Correct answer

Martin Hejtmanek answered on February 2, 2016 07:19

Hi, if you are using setting Store files in file system and not in database, then attachment infos do not directly contain binary data. In this case you need to use method AttachmentInfoProvider.GetFile(attachmentInfo, siteName) to get the binary data.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.