cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DKassian
Advocate IV
Advocate IV

Understanding CDS File Field Datatype - MIME Content Type & Storage Type

When using the new "File" type fields in CDS, I'm having trouble using the content stored in the field. It seems the data in the fields is stored as base64 data, with a content of octet-stream. When you download a file to your computer, it recognized the filename and content type (it converts the base64 octet-stream data back into a pdf or jpeg, etc). I cannot figure out how to interpret the filetype in Flow or other programs without relying on the browser/windows to determine the content type. It also does not appear that we can access the metadata associated with the file fields within that api call to retrieve the content? I see there is a "file name" field that is created in the entity that could theoretically be used to map file extensions to content types.

 

My questions regarding these new file types:

1. Can we determine the content-type outside of just the octet-stream that is returned when accessing a file?

2. Where are the files stored? The return data seems very similar to Azure Blob storage data... is this where the data is being stored? and if so can we access the files direct through blob storage?

3. When pulling a record information, (example: MyOrg.crm3.dynamics.com/api/data/v9.0/Entity(RecordGUID)). it shows a GUID in the file field. I assume this means the base 64 data is not being stored directly in the file field and is instead a relationship/reference to a storage system (see point 2)

4. When putting a file field in a Model Driven form, it shows a "remove" button. Is is possible to restrict this? There are use cases where we would like people to be able to view/download the file but not delete it. Can this be accomplished by field security or a JavaScript plugin?

 

Not having the content type come through properly when clicking a file forces a download every time, when the browser could natively display some files (like PDFs). Additionally we are struggling because we would like to have a web resource on the form that displays the PDF in a viewer. I have resorted to having a web resource reference a http url that triggers a flow, gets the content from the field and returns a response with the file content and the data-type application/pdf so the pdf viewer can view the pdf right in the form. This would be a lot simpler if I could directly reference the file field.

 

Now that we can upload/download files from model driven forms it opens up a huge amount of use cases, but there are a few difficulties that are making it challenging currently.

 

Thanks!

 

image.png

 

 

 

 

 

 

 

 

 

 

image.png

2 REPLIES 2
NHelgren
Power Apps
Power Apps

Based on your message it looks like you are working with Model Driven apps. A new File data type has been released in preview for Canvas and is in the process of deployment right now for Model Driven apps. This new File data type will store the files in non-relational file storage and will chunk uploads and downloads.

Hi @DKassian

There's also a new Image field data type in preview for CDS which works for model-driven apps, so if you're working with images might be worth to check that out.

Cheers

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Apps Ideas

Check out the New Ideas Site

We are excited to announce a new way to share your ideas for Power Apps!

Users online (3,347)