【问题标题】:How to retrive records from OData service of crm 2011 IFD如何从 crm 2011 IFD 的 OData 服务中检索记录
【发布时间】:2013-05-02 15:00:19
【问题描述】:

我有闲置代码。

var ctx = new XrmContext(new Uri(serviceUrl));
ctx.Credentials = new NetworkCredential("username", "password", "domain");
ctx.AccountSet.First();

Silverlight 版本是(在 fiddler 中我们有相同的结果)

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

是什么给了我坠落的错误。

响应负载是无效响应负载。请做出来 确保顶级元素是有效的 Atom 元素或属于 'http://schemas.microsoft.com/ado/2007/08/dataservices' 命名空间。

当我查看提琴手时,我看到重定向到 adfs 服务器

我看到了这个link,但它是针对 CRM 4 的,而且在 OData 的上下文中我不能放置令牌。

我的目标是这样,

为业务逻辑 (BL) 目的制作 Silverlight 库 - 这样我就可以在我的计算机上轻松调试它 - 它将在 CRM 环境中完美运行,

我该怎么做?

【问题讨论】:

    标签: c# silverlight dynamics-crm-2011


    【解决方案1】:

    您需要生成早期绑定的类(使用 crmsvcutil.exe)并指定ServiceContextName 参数。

    假设你的上下文是XrmContext,你需要这样实例化:

    var context = new XrmContext(service);
    

    其中serviceIOrganizationService 网络服务。

    您不需要指定凭据,因为在您实例化 OrganizationServiceProxy 时会处理连接凭据

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

    【讨论】:

    • 这对 Silverlight 插件很有用 - 但对于在本地计算机上的 Silverlight 上运行 - 如果我不在 CRM 域中,它将无法工作(我编辑了问题)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-24
    • 2012-02-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多