read data from file type in dynamics 365
InitializeFileBlocksDownloadRequest initializeFile = new InitializeFileBlocksDownloadRequest();
initializeFile.FileAttributeName = "cr269_filedatatype"; // attribute name
initializeFile.Target = new EntityReference("account", Guid.Parse("37F480BE-EA1F-EA11-A810-000D3A569DFF"));
InitializeFileBlocksDownloadResponse initializeFileResponse = (InitializeFileBlocksDownloadResponse)service.Execute(initializeFile);
Console.WriteLine($"File Name: {initializeFileResponse.FileName}");
Console.WriteLine($"File size (bytes): {initializeFileResponse.FileSizeInBytes}");
var fileContinuationToken = initializeFileResponse.FileContinuationToken;
// code to downlod the file.
DownloadBlockRequest downloadRequest = new DownloadBlockRequest();
downloadRequest.Offset = 0;
downloadRequest.BlockLength = (long)4 * 1024 * 1024; // can be max of 4 MB
downloadRequest.FileContinuationToken = fileContinuationToken;
DownloadBlockResponse downloadBlockResponse = (DownloadBlockResponse)service.Execute(downloadRequest);
byte[] fileBytes = downloadBlockResponse.Data;