I am totally new in dynamic crm and i have to retrieve data from crm using odata in windows phone. i have written code but its giving error. private cresol1Context entities;
private readonly Uri OdataUri = new Uri("https://cresol1.crm5.dynamics.com/XRMServices/2011/OrganizationData.svc/");
private DataServiceCollection<Lead> lstcustomer;
// Constructor
public MainPage()
{
InitializeComponent();
entities = new cresol1Context(OdataUri);
// entities.Credentials == new NetworkCredential(("[email protected]", "********", "cresol1.crm5.dynamics.com");
//entities.AccountSet.First();
lstcustomer = new DataServiceCollection<Lead>(entities);
//query
var result = from r in entities.LeadSet select r;
lstcustomer.LoadCompleted += lstcustomer_LoadCompleted;
lstcustomer.LoadAsync(result);
// Sample code to localize the ApplicationBar
//BuildLocalizedApplicationBar();
}
void lstcustomer_LoadCompleted(object sender, LoadCompletedEventArgs e)
{
if (e.Error == null)
{
if (lstcustomer.Continuation != null)
{
lstcustomer.LoadNextPartialSetAsync();
}
else
{
this.LayoutRoot.DataContext = lstcustomer;
}
}
else {
MessageBox.Show("Some error"+e.Error.Message," error",MessageBoxButton.OK);
}
}
when we run this application we get this error the response payload is a not a valid response payload. please make sure that the top level element is a valid atom element or belongs to 'http://schemas.microsoft.com/ado/2007/08/dataservices' namespace.
any help .?