2016-03-14 319 views
0

大家,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中我沒有構建錯誤和錯誤。

回答

0

似乎是通過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