Share via

Cannot retrieve File column content using Webapi

Power Coder 0 Reputation points
2024-12-21T05:42:18.15+00:00

Hi,

I am trying to get the file content from the file type column in dataverse to my Power pages portal.

I have followed the documentation -

  1. Created Webapi site setting to enable it (Webapi/sm_candidate/enabled)
  2. Created a site setting for fields (Webapi/sm_candidate/fields with value sm_name,sm_domicile)
  3. Using the below code to fetch the data -
webapi.safeAjax({
        type: "GET",
        url: "/_api/sm_candidates("+ id +")/sm_domicile",
        contentType: "application/json",
        success: function (data, textStatus, xhr) {
            var fileContent = data["value"]; // Base 64
            var fileName = "file.bin"; // default name
        },
        error: function (xhr, textStatus, errorThrown) {
            console.log(xhr);
        }
    });

But it is giving me error like -

{
  "error": {
    "code": "90040101",
    "message": "Attribute * in table sm_candidate is not enabled for Web Api."
  }
}

When I change the value of Webapi/sm_candidate/fields site setting to '*****'. It works.

Not sure what I am doing wrong here.

Community Center | Not monitored
0 comments No comments

1 answer

Sort by: Most helpful
  1. Anonymous
    2024-12-23T03:56:42.5633333+00:00

    Hi Power Coder,

    Thank you for reaching out to us on the Microsoft Q&A forum. 

    This topic is currently not supported in the Q&A forums. 

    We recommend initiating a new discussion through the https://community.powerplatform.com/forums/thread/?discussionforumid=2d2e1ce5-b1f0-4025-84d7-e15d00c6ab4b

    Moderators are readily available there to assist you and provide guidance. 

    Please don't forget to Accept/Upvote helpful answer and close this thread.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.