web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested answer

Get content of new file type field in plugin

(0) ShareShare
ReportReport
Posted on by 12

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. 

I have the same question (0)
  • Johao Larios Profile Picture
    1,795 on at
    RE: Get content of new file type field in plugin

    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,

  • Mikhail.T Profile Picture
    12 on at
    RE: Get content of new file type field in plugin

    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.

  • Suggested answer
    Mikhail.T Profile Picture
    12 on at
    RE: Get content of new file type field in plugin

    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);

  • Manojkumar H. Tiwari Profile Picture
    10 on at
    RE: Get content of new file type field in plugin

    How to read the file content, in my case it is excel. i want to read the sheet/workbook to create entity records.

  • danieldnds Profile Picture
    5 on at
    RE: Get content of new file type field in plugin

    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?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 247

#2
Tom_Gioielli Profile Picture

Tom_Gioielli 166 Super User 2025 Season 2

#3
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 164

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans