Closed danielpastoor closed 2 years ago
@danielpastoor image and file datatypes are definitely supported. Try upload method on OData client:
$client->getClient()->upload( 'cra35_incident_files', $incidentID, 'cra35_file', file_get_contents($file->path()), 'whateverthefilenameis' );
Don't think we have a sample handy but the above should work
Thank you for your quick response. Now my file upload works.
But now if I want to retrieve the file with this code:
$query = new \AlexaCRM\Xrm\Query\QueryByAttribute( 'cra35_incident_files' ); $query->AddAttributeValue( 'cra35_incident_id', '(Id)'); $query->ColumnSet = new \AlexaCRM\Xrm\ColumnSet( [ 'cra35_file'] ); $collection = $client->RetrieveMultiple( $query);
Then I only get the file ID is it possible to retrieve the base64 of the file
@danielpastoor as per https://docs.microsoft.com/en-us/powerapps/developer/data-platform/file-attributes, RetrieveMultiple cannot be used to retrieve a file column value. You need to access them on record-by-record basis.
I can upload images to dataverse with base64_encode but not files to the file column.
Is there any example for this or is file upload not supported?
This is my code: