c# - How to retrive records from OData service of crm 2011 IFD -


i have fallowing code.

var ctx = new xrmcontext(new uri(serviceurl)); ctx.credentials = new networkcredential("username", "password", "domain"); ctx.accountset.first(); 

silverlight version (in fiddler have here same result)

var ctx = new adzzcontext(new uri(serviceuri));  ctx.httpstack = system.data.services.client.httpstack.clienthttp; ctx.usedefaultcredentials = false; ctx.credentials = new networkcredential("username", "password", "admin");  var query = ctx.accountset;  var async = new dataservicecollection<account>(); async.loadcompleted += async_loadcompleted; async.loadasync(query); 

what give me falling error.

the response payload not valid response payload. please make sure top level element valid atom element or belongs 'http://schemas.microsoft.com/ado/2007/08/dataservices' namespace.

when @ fiddler see redirect adfs server redirect

i saw link, crm 4, , in context of odata can't put token.

my target so,

to make silverlight library business logic (bl) purpose - can debug in computer - , run in crm environment,

how can it?

you need generate bound classes (using crmsvcutil.exe) , specify servicecontextname parameter.

assuming context xrmcontext, need instantiate in way:

var context = new xrmcontext(service); 

where service iorganizationservice web service.

you don't need specify credentials because connection credentials handled when instantiate organizationserviceproxy

sample code: http://nishantrana.wordpress.com/2010/11/03/sample-code-for-using-iorganizationservice-in-crm-2011/


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -