Windows phone 8 如何在windows phone中使用OData服务从Dynanic crm读取数据?
我是动态crm的新手,我必须在windows phone中使用odata从crm检索数据。我已经写了代码,但给出了错误。 私有Cresol1上下文实体Windows phone 8 如何在windows phone中使用OData服务从Dynanic crm读取数据?,windows-phone-8,odata,dynamics-crm,Windows Phone 8,Odata,Dynamics Crm,我是动态crm的新手,我必须在windows phone中使用odata从crm检索数据。我已经写了代码,但给出了错误。 私有Cresol1上下文实体 private readonly Uri OdataUri = new Uri("https://cresol1.crm5.dynamics.com/XRMServices/2011/OrganizationData.svc/"); private DataServiceCollection<Lead> lstcust
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(("mspnitesh@cresol1.onmicrosoft.com", "********", "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);
}
}
private只读Uri OdataUri=新Uri(“https://cresol1.crm5.dynamics.com/XRMServices/2011/OrganizationData.svc/");
私人数据服务收集客户;
//建造师
公共主页()
{
初始化组件();
实体=新的Cresol1上下文(OdataUri);
//entities.Credentials==新的网络凭据((“mspnitesh@cresol1.onmicrosoft.com“,”、“*******”、“cresol1.crm5.dynamics.com”);
//entities.AccountSet.First();
lstcustomer=新数据服务集合(实体);
//质疑
var结果=来自实体中的r。领导集选择r;
lstcustomer.LoadCompleted+=lstcustomer\u LoadCompleted;
lstcustomer.LoadAsync(结果);
//本地化ApplicationBar的示例代码
//BuildLocalizedApplicationBar();
}
void lstcustomer\u LoadCompleted(对象发送方,LoadCompletedEventArgs e)
{
如果(e.Error==null)
{
if(lstcustomer.Continuation!=null)
{
lstcustomer.LoadNextPartialSetSync();
}
其他的
{
this.LayoutRoot.DataContext=lstcustomer;
}
}
否则{
MessageBox.Show(“一些错误”+e.error.Message,“error”,MessageBoxButton.OK);
}
}
当我们运行此应用程序时,会出现此错误
响应负载不是有效的响应负载。请确保顶级元素是有效的atom元素或属于“”命名空间
有什么帮助吗?似乎您使用了错误的身份验证方法。请重新检查以下描述如何实现此目的的文章-