【问题标题】:How to read data using OData service from Dynanic crm in windows phone?如何使用 Windows Phone 中 Dynamics crm 中的 OData 服务读取数据?
【发布时间】:2014-11-20 10:02:44
【问题描述】:

我是动态 crm 的新手,我必须使用 windows phone 中的 odata 从 crm 检索数据。我已经编写了代码,但它给出了错误。 私有 cresol1Context 实体;

   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);

        }
    }

当我们运行这个应用程序时,我们得到这个错误 响应负载不是有效的响应负载。请确保顶级元素是有效的原子元素或属于“http://schemas.microsoft.com/ado/2007/08/dataservices”命名空间。

有什么帮助吗?

【问题讨论】:

    标签: windows-phone-8 odata dynamics-crm


    【解决方案1】:

    您似乎使用了错误的身份验证方法。重新检查以下描述如何完成的文章 - http://msdn.microsoft.com/en-us/library/dn481603.aspx

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-18
      相关资源
      最近更新 更多