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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested Answer

How to use Dataverse Web API to upload file as JSON

(1) ShareShare
ReportReport
Posted on by 2
Hi,
 
I try to upload a adaptive card to dataverse by using a column declared as a file.
 
Even I need some meta information about team and channel for Microsoft Teams. By writing the information inside the table will trigger a work flow inside the professional environment.
 
I'm using Java:
 
public record AdaptiveCards (String craa5_team, String craa5_channel, String craa5_adaptivecards) {
}

File file = ResourceUtils.getFile("classpath:payloads/webhook_payload_02.json");

String base64;
try (FileInputStream fis = new FileInputStream(file); ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
    byte[] buffer = new byte[1024];
    int len;
    while ((len = fis.read(buffer)) != -1) {
        baos.write(buffer, 0, len);
    }
    base64 = Base64.getEncoder().encodeToString(baos.toByteArray());
}

AdaptiveCards payload = new AdaptiveCards("team", "channel", base64);
RequestBody requestBody = RequestBody.create( new ObjectMapper().writeValueAsString(payload), MediaType.parse("application/json") );
Request request = new Request.Builder()
.url( https://abc.crm4.dynamics.com/api/data/v9.2/tablename")
.post(requestBody)
.addHeader("Authorization", "Bearer " + accessToken) 
.addHeader("Accept", "application/json") .build(); 

try (Response response = new OkHttpClient().newCall(request).execute()) {
 
By sending out the request I running in the error message:
Connection returned HTTP code: 400 with message: {"error":{"code":"0x80060888","message":"The file attribute value sent ... is not a valid Guid."
 
Using a UUID returns success but I wonder how should I upload the file.
 
Does anybody has expierence and could give me an advice?
 
Thanks,
Markus
Categories:
I have the same question (0)
  • Suggested answer
    Sohail Ahmed Profile Picture
    11,169 Super User 2026 Season 1 on at

    To upload a file (like your Adaptive Card JSON) to a Dataverse file column, you're hitting an error because Dataverse expects a two-step process or multipart/form-data, not a Base64 string directly within the entity's JSON payload for a file column.

    1. Create/Update the entity record without the file content.
    2. Then, send a separate PUT request to the specific file column endpoint (/api/data/v9.2/entity_collection(record_id)/file_column_name) with the binary content of your file (or Base64 wrapped in {"value":"..."} JSON).
    3. The error "not a valid Guid" means Dataverse is misinterpreting your Base64 string as an attempt to provide a file reference GUID, not the file content.
     
     
    ✅ Mark this answer as verified if it helps you.

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 Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
11manish Profile Picture

11manish 166

#2
ManoVerse Profile Picture

ManoVerse 54 Super User 2026 Season 1

#3
Niki Patel Profile Picture

Niki Patel 40

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans