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 :
Finance | Project Operations, Human Resources, ...
Unanswered

How to create my own odataUtility?

(0) ShareShare
ReportReport
Posted on by 1,965

Hi I want to create my own datautility to be able to call salesOrderHeaderV2Entity

1.I downloaded  OData client code generator in visual studio

2. Took Authentication utility from gitHub

3. Created a new C# project of type Class Library with the name ODataUtility.

4.  deleted the default class (class1) that is created.
5.  I Right clicked on project and clicked “New item” and chose “OData Client” 

6. I Open ODataClient.tt file and replaced public const string MetadataDocumentUri = “”with public const string MetadataDocumentUri = "D365FOURL/data/$metadata"

 Also replaced public const string TempFilePath = ""    with public const string TempFilePath @”C:\Temp\Edmx.xml”

I didn't create any file

However i got the two following errors:

pastedimage1618385596810v1.png

what am i missing?

I have the same question (0)
  • Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    Why did chabge change both MetadataDocumentUri and TempFilePath? Which one do you want to actually use?

    Also, your steps say nothing about creating Edmx.xml. How did you make it?

  • .. Profile Picture
    1,965 on at

    Hi Martin,

    I don't know what both means

    I was just trying to follow an article.

    What does edmx means?

    All i know i want is that i want to create an order in d365 using SalesOrderHeaderV2

    Can you guid me please with the steps on how to create my own odatautility successfully?

  • Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    Which article are you trying to follow?

    EDMX is the format of data returned by the $metadata endpoint. It describes entities, fields etc. You don't have to worry about its details, but if you're interested, simply look at the data.

    You'll need to decide whether your want to get metadata from the URL or a file. And if you want to use a file, you need create the file before you can do that. You might also adjust the file before generating code, e.g. with EDMXTrimmer.

  • .. Profile Picture
    1,965 on at

    Hi Martin,

    what do u mean if i should get data from URL or file

    I'm doing an import to create a sales order in d365Fo so i didn't get what u mean by the sentence above, why do i need to get data if i'm importing?

    I'm following this article steps:  www.d365ug.com/.../third-party-integration-in-d365fo-using-odata

    However I tried now to only change the Metadata Url and not the tempFilePath by this
     public const string MetadataDocumentUri = “”with public const string MetadataDocumentUri = "D365FOURL/data/$metadata" 

    but i got this error

    Combined length of user strings used by the program exceeds allowed limit. Try to ODatUtility decrease use of string literals

  • Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    You want to write C# class with classes like SalesOrderHeaderV2Entity. These classes much be created somehow - namely by OData Client Code Generator. This generator must get information about entities in your F&O environment, and the source of data is OData metadata. You can either refer to the URL, or download the file from the URL and refer to a local file. Is it clear now?

    Regarding the error, look at github.com/.../1220 or other discussions on the internet.

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 660 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 307 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans