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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / SDK Support for File t...
Power Apps
Unanswered

SDK Support for File type attributes?

(0) ShareShare
ReportReport
Posted on by 16

There does not seem to be SDK support for the new File type attributes.


The documentation (here) talks about calling the web service directly when working with these, however the example methods require me to supply 7 parameters including an access token and don't seem to fit a real world example. I am not sure if that code is even achievable inside a plugin.


In addition, none of the tools that use CrmSvcUtil seem to generate a class for a File type attribute. Maybe there is better support in the upcoming release wave though if there is I couldn't find a reference.


I will continue to test eg late binding and accessing the web service inside a plugin or an external app eg a logic app, but would be grateful to hear if others have worked with File attributes in code and how you did it.

I have the same question (0)
  • Diana Birkelbach Profile Picture
    3,072 Most Valuable Professional on at

    Hi @PJ99 

     

    I haven't tried it out myself, but I remember seeing blogs where is explained how to work with the file attributes.

    Something like this: https://debajmecrm.com/new-data-type-filein-cds-all-you-may-need-to-know-about-it/

    Maybe it helps.

     

    Kind regards,

    Diana

  • PJ99 Profile Picture
    16 on at

    Thanks @DianaBirkelbach - great start thank you.

    I was not aware of those SDK messages (InitializeFileBlocksDownloadRequest & InitializeFileBlocksUploadRequest etc) so a really useful post for me and I got the download to work using that. 

    Unfortunately his blog has no upload equivalent and I am unable to get this working so obviously I have something wrong.  This is what I tried which executes without exception but no change occurs to the target record/attribute.  This File attribute is such a great CDS feature so I am surprised no-one seems to be using it in code.

    private static void UploadFile(CrmServiceClient service, byte[] processedDoc)
    {

    InitializeFileBlocksUploadRequest req = new InitializeFileBlocksUploadRequest();
    req.FileAttributeName = "rss_invoicefile";
    req.FileName = "Invoice.docx";
    req.Target = new EntityReference("rss_invoice", Guid.Parse("7d14c17f-be9e-ea11-a812-000d3ad20d1c"));

    InitializeFileBlocksUploadResponse resp = (InitializeFileBlocksUploadResponse)service.Execute(req);


    UploadBlockRequest uploadRequest = new UploadBlockRequest();
    uploadRequest.BlockData = processedDoc;
    uploadRequest.BlockId = GuidToBase64(Guid.NewGuid());
    uploadRequest.FileContinuationToken = resp.FileContinuationToken;

    UploadBlockResponse uploadResponse = (UploadBlockResponse)service.Execute(uploadRequest);
    Console.WriteLine($"Reponse name: {uploadResponse.ResponseName}");

    }

     

    kind regards,
    Paul

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 1,055

#2
Valantis Profile Picture

Valantis 666

#2
11manish Profile Picture

11manish 666

Last 30 days Overall leaderboard