CRM 2015 在线OData服务

CRM 2015 Online OData Service

各位,

我正在努力在 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 link 中找到的代码没有什么不同。我在 Visual Studio.

中没有构建错误和错误

通过 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.