Dynamics CRM 2011 实体

3
我非常新于Dynamics CRM,并开始学习如何开发使用CRM Web服务的自定义应用程序。
我有Dynamics CRM SDK,并从微软提供的实验室开始,因此我现在有一个小型测试应用程序,可以列出已登录用户的组织。
这个测试应用程序可以创建新的记录,但我实际上感兴趣的是访问故障单实体。
我有以下内容。
Entity location1 = new Entity("account");
location1["name"] = LocationName.Text;
location1.Id = this.OrgService.Create(location1);
MessageBox.Show("New Location ID is " + location1.Id.ToString());

但是我真正想做的是在这个领域做些什么。
Entity location1 = new Entity("incedent");
location1["title"] = LocationName.Text;
location1.Id = this.OrgService.Create(location1);
MessageBox.Show("New Location ID is " + location1.Id.ToString());

但我得到了一个异常,指出没有这样的实体,然而当我通过IE登录CRM时,我可以毫无问题地创建一个案例。
我假设我的方法是错误的,所以我希望有人能指点我如何正确使用这些WCF服务,并提供我可以用这种方式创建的实体列表,以及如何创建新的案例/事件实体。
谢谢。
3个回答

6

我认为你有一个错别字。

案例实体的名称是incident而不是incedent


我在哪里可以找到所有实体名称的列表? - Armand
1
http://msdn.microsoft.com/zh-cn/library/gg334400.aspx,在菜单的左侧有关于不同实体的主题。 - surfen

2

在你的例子中,“incident”这个单词被拼错了。请检查一下是否是这个问题。


0

好的!您应该将实体名称写为"incident"而不是"incedent"

一旦您拥有记录的,您可以通过组织服务访问它,如下所示:

//   To retrieve  all columns  from contact entity for example
ColumnSet cols = new ColumnSet({ Allcolumns = true });
Entity retrievedIncident = OrgService.Retrieve("contact", id, cols);

//   To retrieve  specific columns 
ColumnSet cols = new ColumnSet(new String[] { "name", "address1_postalcode", "    lastusedincampaign", "versionnumber" });
Entity retrievedIncident = OrgService.Retrieve("contact", id, cols);

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接