CRM 2015在线OData服务

问题描述:

大家,CRM 2015在线OData服务

我正在显示sharepoint中的只读crm数据。我遵循Develop1.net的指示。这意味着我使用了CRM 2015 SDK中的WebAppWalkthrough。这工作得很好,数据确实出现在我的SharePoint应用程序中。但是,当我生成一个新文件xrm.cs,以访问我的定制的,我得到了我的broswer如下:

Request Error

我没有在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标志添加到上面的代码。再次生成文件没有错误,但只要我将它添加到解决方案,我得到错误mesassge。

所以我虽然也许是WebAppWalkthrough有问题。我再次重新下载了SDK,并且遇到了相同的问题。所以我决定按照Microsoft的指示从零开始构建OData服务。同样的错误再次。

我的代码与SDK或微软链接中的代码没有区别。在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. 
+0

早期绑定生成器插件远远优于普通的旧的CrmSvcUtil。很高兴你明白了。 – Polshgiant