user3062774
user3062774

Reputation:

OData Default company and adjusting Service Config Files in Silverlight App being built in MS Visual Studio 2013

I'm building a Lightswitch application using MS Visual Studio 2013. As part of this I access data through an OData url (referencing a dynamics nav project) which does not seem to want to pick up the company data in the url. (It does without it). However then within Visual Studio I only see the column headers and no data. When I debug I get the following error message:

"Cannot process the request because the default Microsoft Dynamics NAV company cannot be found. You can specify a default company in the service configuration file, or specify one for each tenant, or you can add a query string in the form of "company=[name]". You can see the available companies by accessing the default OData web service, Company. For more information, see "OData Web Services" in Help."

For example: (OData url): localhost:7048/DynamicsNAV70/OData/Company('CRONUS%20International%20Ltd.')/SalesOrder

But only viewable as: localhost:7048/DynamicsNAV70/OData/ and then selecting SalesOrder

My question is, what config files are they refering to? (Visual studio?If so how do I add the company name?) "OData Web Services" in Help was of no use.

Upvotes: 1

Views: 2513

Answers (1)

user3062774
user3062774

Reputation:

I had to add additional code within Visual Studio to reference the company, for example:

ServiceReference1.NAV nav = new ServiceReference1.NAV(new Uri("http:...../OData/Company('company_name')/"));

nav.Credentials = new System.Net.NetworkCredential("user", "password", "domain");

Upvotes: 2

Related Questions