Skip to main content

Notifications

Power Pages - Customize & Extend
Unanswered

Cannot retrieve File column content using Webapi

Posted on 26 Nov 2024 13:17:51 by
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 cbange the value of Webapi/sm_candidate/fields site setting to '*'. It works.
Not sure what I am doing wrong here.
 
 
Categories:
  • Suggested answer
    SaiRT14 Profile Picture
    SaiRT14 911 on 27 Nov 2024 at 00:40:39
    Cannot retrieve File column content using Webapi
     
    The issue stems from how the Web API site settings are configured in your Power Pages portal. The error message indicates that the attribute (sm_domicile) in your Dataverse table (sm_candidate) is not explicitly enabled for Web API access.
     
    The site setting Webapi/sm_candidate/fields defines which attributes (columns) in the sm_candidate table are accessible through the Web API. You must include sm_domicile in this setting. sm_name,sm_domicile
     
    let me know  if you need more details.

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

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,129

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,797

Leaderboard

Featured topics