A while ago I was working on a widget where I need to be able to download the contents of a FileDocument. In the old Custom Widget era this worked fine with the ‘Binary’ attribute, but in Pluggable Widgets land this attribute type is utterly useless… We can still define it, see docs, but the value of this attribute is empty.
The ‘Binary’ attribute is useful though, because we can make sure we target a FileDocument object (or Image, as that is also a FileDocument). In its current state it cannot be used though, which is sad.
Here’s my proposal for R&D to get useful information in the client API (choose which one is more useful):
1.) Return either a FileValue or ImageValue. The only thing we need in order to either download or fetch it, is the ‘uri’ property in either value (which is universal). I know that in the back-end you use ‘mx.data.getImageUrl’ or ‘mx.data.getDocumentUrl’ (but both have not been documented in the client API) to generate these URI’s.
2.) Return a somewhat more verbose FileValue back, that contains:
Got my vote!
I encountered this as well and had to resort to the client API functions… It seems to be an unfinished implementation. You have my upvote!