Skip to main content

Notifications

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. 

  • 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?

  • 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.

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

  • 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.

  • 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,

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Daivat Vartak (v-9davar) Profile Picture

Daivat Vartak (v-9d... 225 Super User 2025 Season 1

#2
Eugen Podkorytov Profile Picture

Eugen Podkorytov 106

#2
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 106 Most Valuable Professional

Overall leaderboard

Product updates

Dynamics 365 release plans