I’m trying to access D365 AX using odataclient C#
1.I have downloaded solution from NuGet (https://github.com/Microsoft/Dynamics-AX-Integration)
2.In ClientConfiguration class I have assigned required variables partly by taken information from Azure portal
3.To the ODataUtility project, I added an Item ("OData v4 Client Code Generator") as described here (community.dynamics.com/.../integration-with-dynamics-365-for-operations-using-odata-proxy-generator) by modifying public const string MetadataDocumentUri ,
so the ("OData v4 Client Code Generator") has created a ODataClient.cs
4.So, finally, when I try to run the Program
it cause the error
System.TypeInitializationException was unhandled
HResult=-2146233036
Message=The type initializer for 'GeneratedEdmModel' threw an exception.
Source=ODataUtility
TypeName=GeneratedEdmModel
StackTrace:
at ODataUtility.Microsoft.Dynamics.DataEntities.Resources.GeneratedEdmModel.GetInstance()
at Microsoft.OData.Client.DataServiceClientFormat.get_ServiceModel()
at Microsoft.OData.Client.DataServiceClientFormat.UseJson()
at ODataUtility.Microsoft.Dynamics.DataEntities.Resources..ctor(Uri serviceRoot) in C:\Users\MyUser\Documents\Visual Studio 2015\Projects\Dynamics-AX-Integration-master\ServiceSamples\ODataUtility\ODataClient.cs:line 31
at ODataConsoleApplication.Program.Main(String[] args) in C:\Users\MyUser\Documents\Visual Studio 2015\Projects\Dynamics-AX-Integration-master\ServiceSamples\ODataConsoleApplication\Program.cs:line 19
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
HResult=-2147024885
Message=[C:\Users\MyUser\Documents\Visual Studio 2015\Projects\Dynamics-AX-Integration-master\ServiceSamples\ODataConsoleApplication\bin\Debug\ODataUtility.dll] No string associated with token.
Source=ODataUtility
StackTrace:
at ODataUtility.Microsoft.Dynamics.DataEntities.Resources.GeneratedEdmModel.LoadModelFromString()
at ODataUtility.Microsoft.Dynamics.DataEntities.Resources.GeneratedEdmModel..cctor() in C:\Users\MyUser\Documents\Visual Studio 2015\Projects\Dynamics-AX-Integration-master\ServiceSamples\ODataUtility\ODataClient.cs:line 54685
InnerException:
I see that error is raised here
- I tried google with “No string associated with token” and found this post (left actually unanswered I think) https://www.codeproject.com/Questions/1259879/Access-D365-AX-using-odataclient-Csharp
- Also, when I started creating of this post, I was suggested similar topics (but non of them is what I need)
So, the question is: how to fix the error "No string associated with token" ?
My high level Goal is to put a pictures to AX by using DataEntity (https://community.dynamics.com/365/financeandoperations/f/dynamics-365-for-finance-and-operations-forum/364560/import-images-into-ax - thank you Martin, thank you Nikolaos but management/architect has decided to store pictures in AX) - so maybe I choose wrong direction ?

Report
All responses (
Answers (