Good day community,
Is there a way to get content of the new file type in a plugin?
https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/file-attributes
I see we can get content by web API. But in a plugin, I can only see a file name and some GUID.
Any suggestions?
Thanks,
Mikhail.
When I add this code to my plugin project, it builds fine but when I use the Plugin Registration Tool to debug by code I get an error:
Could not load type 'Microsoft.Crm.Sdk.Messages.InitializeFileBlocksDownloadRequest' from assembly 'Microsoft.Crm.Sdk.Proxy'
Did you have the same issue? If so, how did you work around that?
How to read the file content, in my case it is excel. i want to read the sheet/workbook to create entity records.
For those who looking for the same.
First we requesting FileContinuationToken and then calling DownloadBlockRequest that will return byte array data for us.
InitializeFileBlocksDownloadRequest ifbdRequest = new InitializeFileBlocksDownloadRequest { Target = new EntityReference("nameoftheentitywithfiletype", new Guid("2bffcfbb-dbae-ea11-a812-000d3abaac27")), FileAttributeName = "filefieldname" }; InitializeFileBlocksDownloadResponse ifbdResponse = (InitializeFileBlocksDownloadResponse)_service.Execute(ifbdRequest); DownloadBlockRequest dbRequest = new DownloadBlockRequest { FileContinuationToken = ifbdResponse.FileContinuationToken }; var resdbResponsep = (DownloadBlockResponse)_service.Execute(dbRequest);
Good day, Johao,
Many thanks for your reply!
C# example shows using web API. For using web API from plugin I need to create application in Azure for correct authentication and this way not looks good for me.
Can you explain what do you mean by SOAP request from plugin?
Because what I know that is SDK doing SOAP request behind the scene and in response there is no actual content of the file(checked that in Fidller from a console app).
In MS article we can find - File attributes are supported in SdkClientVersion 9.0.45.329 or greater and Web API version 9.1 or greater.
But latest SDK for now has version - 9.0.45.2156. I tried to send version that was mentioned in article but it gave nothing.
Mikhail.
I see an example using C#: docs.microsoft.com/.../file-attributes
Attributes: docs.microsoft.com/.../microsoft.xrm.sdk.metadata.fileattributemetadata
So, what I would do is register the plugin in the post operation and then use the soap request to retrieve the file.
Retrieve file: docs.microsoft.com/.../file-attributes
Regards,
Daivat Vartak (v-9d...
225
Super User 2025 Season 1
Eugen Podkorytov
106
Muhammad Shahzad Sh...
106
Most Valuable Professional