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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Unanswered

Dataverse API and C#

(0) ShareShare
ReportReport
Posted on by 487

Hi Everyone,

I have a technical question about using the dataverse api and I do not know where else to ask it.

We are using the api to communicate with the data in a backend c# app. Right now, when working with relations, when we GET the object, we use the following variable for relations:

_###_XXXXXX_value
###: environement prefix
XXXXXXX: variable name
This gives the GUID of the related object. 
However, when we POST or PUT, we do some ugly stringreplace of the json, before posting it. For example:
jsonData = jsonData.Replace("_PREF_customfield_value", "PREF_CustomField@odata.bind");
jsonData = jsonData.Replace(THEOBJECTGUID, "/products(" + THEOBJECTGUID + ")");
Here we have a field which is a many to one relationship with products. As you can see, we do some replacements to end up with the following in our json
"PREF_CustomField@odata.bind":"/products(" + THEOBJECTGUID + ")"
This is rather annoying and dirty as this means data manipulation on every json that has relations.
Is there any simpler way? Like a library that will do it automatically? Or another way to format the json?
Cheers
I have the same question (0)

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Martin Dráb Profile Picture

Martin Dráb 47 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 38 Super User 2025 Season 2

#3
Pallavi Phade Profile Picture

Pallavi Phade 32

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans