简体   繁体   中英

CRM 2015 Online OData Service

Everyone,

I am working on displaying read-only crm data in sharepoint. I followed the directions at Develop1.net . So that means that I used the WebAppWalkthrough from in the CRM 2015 SDK. This worked great and the data does appear in my SharePoint App. But, when I generate a new xrm.cs file, to get access to my customization's, I get the following in my broswer:

请求错误

I did use the included CrmSvcUtil.exe in the SDK. The code that I ran to generate the xrm.cs file is:

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

This will successfully create a new xrm.cs file but as soon as I update my solution and rebuild it I get the Request Error in the browser. I have tried the above code with the /generateActions flag and even registered my computer using the Device Registration Tool to get a deviceid and devicepassword . I then added the \\deviceid and \\devicepassword flags to the above code. Again the file is generated with no errors, but as soon as I add it to the solution I get the error mesassge.

So I though maybe it was something wrong with the WebAppWalkthrough. I redownloaded the SDK again and had the same issues. So I decided to build the OData service from scratch following the directions at Microsoft . Same error again.

My code is no different then what can be found in the SDK or at the Microsoft link. I get no build errors and no errors in Visual Studio.

There appears to be an issue with the way code is generated via the CrmSvcUtil.exe. Here is what I ended up doing that got things to work:

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM