从Java连接MS Dynamics CRM 2011 [英] Connect MS Dynamics CRM 2011 from java

查看:72
本文介绍了从Java连接MS Dynamics CRM 2011的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从Java连接到MS Dynamics CRM 2011。经过大量搜索之后,我在MS论坛中找到一个链接,该链接提供了一个代码片段,用于从Java调用MS Dynamics CRM 2011 WS。



使用Java消费CRM REST服务



但是,除了帐户创建步骤外,它没有提供太多详细信息。使用此代码段,我可以创建帐户。但是,我也想使用相同的REST Web服务来检索帐户,创建新的案例请求,将案例请求添加到帐户等。基于在线可用的.NET示例,我试图使用 service.createAccountQuery() 方法来检索帐户。但是,尽管所有.NET示例都使用LINQ设置搜索条件,但我不知道如何在Java中指定子路径字符串以按名称/城市/国家等来检索现有帐户。



感谢任何帮助。

解决方案

不确定您是否还在寻找,但对于其他正在寻找的人。我遇到了同样的问题。



它使用的是odata查询网址,因此子路径为entitySet(例如,对于帐户,它为AccountSet)



然后您可以使用.filter方法设置过滤器,并通过.select方法进行选择。



我确实注意到您可以

例如



Query< microsoft.crm.sdk.data.services.Account> q = service.createAccountQuery( AccountSet);
q.filter( substringof('Test',Name));
q.select( AccountId,Name);
q.execute();



您必须执行
Query< microsoft.crm .sdk.data.services.Account> q = service.createAccountQuery( AccountSet)。filter( substringof('Test',Name))。select( AccountId,Name);
q.execute();



Chris


I am trying to connect to MS Dynamics CRM 2011 from Java. After lots of searching I came across one link in MS forums which gives a code snippet to invoke MS Dynamics CRM 2011 WS from Java.

Consuming CRM REST Service from Java

However, it does not provide much details other than an account creation step. Using this code snippet I am able to create accounts. However, I want to also use the same REST web service to retrieve accounts, create new case request, add case request to account, etc. Based on .NET examples available online I am trying to use the service.createAccountQuery() method to retrieve accounts. However, while all .NET examples uses LINQ to setup search criteria, I am clueless how to specify the subpath string in java to retrieve existing Accounts by their name/city/country etc.

Appreciate any help.

解决方案

not sure if you are still looking but for anyone else looking. I had the same issue.

It is using the odata query url so the subpath is the entitySet (e.g. for account it would be AccountSet)

you can then set the filter using the .filter method and the select via the .select method.

I did notice that you can't seem to do these on seperate lines though

e.g. you can't do

Query<microsoft.crm.sdk.data.services.Account> q = service.createAccountQuery("AccountSet"); q.filter("substringof('Test',Name)"); q.select("AccountId,Name"); q.execute();

you must do Query<microsoft.crm.sdk.data.services.Account> q = service.createAccountQuery("AccountSet").filter("substringof('Test',Name)").select("AccountId,Name"); q.execute();

Chris

这篇关于从Java连接MS Dynamics CRM 2011的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆