To Consume a ODataV4 form Visual Studio (+2017) you need to add this extenssions installed:
and the odata will be enabled:
Then you may be to know the url of odatav4 services ( you can know it open the Web Services page and copy some url odatav4), for example:
remove url until odatav4 and add /$metadata:
http://laptop01.inforolot.com:7048/BC160CU5ES/ODataV4/$metadata
save the result on a file
on visual studio create a new conected service, select odata connected service
select the published pages that you want to add
That’s all! , if you make changes on the published web services then you can refresh the connected service:
Sample to consume the odata:
// ————————————————odata—————————————
NAV.NAV conectorcomandes = new NAV.NAV(new Uri(@”http://laptop01.inforolot.com:7048/BC160CU5ES/ODataV4/Company(‘TestCompany’)“));
conectorcomandes.Credentials = new NetworkCredential(“user”, “password”, “domain”);
Task<IEnumerable<Producto>> comandes = conectorcomandes.Producto.AddQueryOption(“$select”, @”Description,No”).ExecuteAsync();