【问题标题】:CRM 2015 Online OData ServiceCRM 2015 在线 OData 服务
【发布时间】:2016-03-14 22:34:31
【问题描述】:

大家,

我正在努力在 sharepoint 中显示只读 crm 数据。我按照Develop1.net 的指示进行操作。这意味着我使用了 CRM 2015 SDK 中的 WebAppWalkthrough。这很好用,数据确实出现在我的 SharePoint 应用程序中。但是,当我生成一个新的 xrm.cs 文件以访问我的自定义文件时,我会在我的浏览器中看到以下内容:

我确实使用了 SDK 中包含的 CrmSvcUtil.exe。我运行生成 xrm.cs 文件的代码是:

CrmSvcUtil.exe
/codeCustomization:"Microsoft.Xrm.Client.CodeGeneration.CodeCustomization, Microsoft.Xrm.Client.CodeGeneration" 
/out:"..\Xrm.cs" 
/url:https://<Org>.api.crm.dynamics.com/XRMServices/2011/Organization.svc 
/username:<user name> 
/password:<password>  
/namespace:Xrm 
/serviceContextName:XrmServiceContext 
/servicecontextprefix:Xrm

这将成功创建一个新的xrm.cs 文件,但是一旦我更新我的解决方案并重建它,我就会在浏览器中收到请求错误。我已经使用/generateActions 标志尝试了上面的代码,甚至使用Device Registration Tool 注册了我的计算机以获得deviceid and devicepassword。然后我在上面的代码中添加了\deviceid and \devicepassword 标志。再次生成的文件没有错误,但是一旦我将它添加到解决方案中,我就会收到错误消息。

所以我认为 WebAppWalkthrough 可能有问题。我再次重新下载了 SDK 并遇到了同样的问题。所以我决定按照Microsoft 的指示从头开始构建 OData 服务。又是同样的错误。

我的代码与 SDK 或 Microsoft 链接中的代码没有什么不同。我在 Visual Studio 中没有遇到任何构建错误和错误。

【问题讨论】:

    标签: c# odata crm dynamics-crm-online dynamics-crm-2015


    【解决方案1】:

    通过 CrmSvcUtil.exe 生成代码的方式似乎存在问题。以下是我最终做的事情:

    1)  I modified the WebAppWalkthrough file.  Basically I just deleted the .aspx pages since I don’t need them.
    2)  I deleted the Xrm.cs file that is in the folder.
    3)  I created a blank C# class file called Xrm.cs.
    4)  I used a tool called XrmToolBox with a plugin called Early Bound Generator
        a.  I was able to create a separate .cs file for each entity including the XrmServiceContext.
    5)  I manually copied the code from the opportunity file and the XrmServiceContext file into the blank Xrm.cs file.
    6)  Anything that had an error in the new Xrm.cs file was deleted
    7)  Added [assembly: Microsoft.Xrm.Sdk.Client.ProxyTypesAssemblyAttribute()] above the namespace.
    8)  Added using Microsoft.Xrm.Portal.Web.Data.Services; inside the namespace.
    

    【讨论】:

    • 早期绑定的生成器插件远远优于普通的旧 CrmSvcUtil。很高兴你明白了。
    猜你喜欢
    • 1970-01-01
    • 2019-01-28
    • 2023-03-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-06-11
    • 1970-01-01
    • 2013-01-10
    相关资源
    最近更新 更多