Tuesday, February 24, 2015

Read odata service in ax 2012 + vs.net c#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Services.Client;




namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {

                Uri url = new Uri("http://win-nc3sculi90s:8101/DynamicsAx/Services/ODataQueryService/");
                var container = new productservice.ODataQueryService(url);
                //productservice.ODataQueryService context = new productservice.ODataQueryService(url);
                container.Credentials = System.Net.CredentialCache.DefaultCredentials;

                var ibnTable = from p in container.IBN_table
                               select p;

                foreach (var data in ibnTable)
                {
                    Console.WriteLine(data.IBN_table_1_Name);
                   
                }
                Console.ReadLine();
             

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.InnerException);
                Console.ReadLine();
            }

        }
    }
}

No comments:

How to identify the user that was used to change an object from AOT in AX2012

Get the object name for which we need to track these (user and date&time) information's. Login to SQL Server Management Studio an...