星期三, 八月 29, 2007

Callout.config.xml 文件

你写完CRM的Callout,应该怎样把它跟CRM连接起来呢? 如果你想把CRM跟你写的程序连接起来, 你就需要在callout.config.xml的文件上加连接。 callout.config.xml的文件一般在 C:\Program Files\Microsoft CRM\Server\bin\assembly文件夹里。

Callout.config.xml 可以在CRM 3.0SDK里找到。但那个例子有很多不需要的东西。如果你想要一个干净callout.config.xml 的模板, 就用以下的吧。只要把以下的放到notepad, 然后把它save成 callout.config.xml 放到assembly文件夹里, 就可以了。

<callout.config version="1.0" xmlns=" http://schemas.microsoft.com/crm/2006/callout/">
<!--在这里加连接-->
</callout.config>





我给一个例子,如果想跟 Account 连接, 在CRM Account Save后, 开动你的程序。你的callout.config.xml例子是以下:

<callout.config version="1.0" xmlns=" http://schemas.microsoft.com/crm/2006/callout/">
<callout entity="account" event="PostCreate">
<subscription assembly="CalloutSample2.dll"
class="CalloutSample2.CalloutComponent"
onerror="abort">
<postvalue>@all</postvalue>
</subscription>
</callout>
</callout.config>
1. PostCreate就是record 创建完后, PostUpdate就是record更新后, PostDelete就是删除后。
2. CalloutSample2.dll就是那个class library的名。如果你写的dll名是hello.dll. 你可以把calloutsample.dll改为你dll的名。
3. calloutcomponent是class的名, 如果你的dll那里有class叫darren,那么就是hello.darren.
4. onerror="abort"意思是说,如果有错误,就停止。 
5. <postvalue>@all</postvalue>, 就把所有字段的值都给你。
以下的例子就在把Account创建完后,更新后, 删除后, 跟你的程式连接上。
<callout.config version="1.0" xmlns=" http://schemas.microsoft.com/crm/2006/callout/">
<callout entity="account" event="PostCreate">
<subscription assembly="CalloutSample2.dll"
class="CalloutSample2.CalloutComponent"
onerror="abort">
<postvalue>@all</postvalue>
</subscription>
</callout>
<callout entity="account" event="PostUpdate">
<subscription assembly="CalloutSample2.dll"
class="CalloutSample2.CalloutComponent">
<postvalue>name</postvalue>
</subscription>
</callout>
<callout entity="account" event="PostAssign">
<subscription assembly="CalloutSample2.dll"
class="CalloutSample2.CalloutComponent"
onerror="ignore">
<prevalue>name</prevalue>
</subscription>
</callout>
<callout entity="account" event="PostDelete">
<subscription assembly="CalloutSample2.dll"
class="CalloutSample2.CalloutComponent"
onerror="ignore"/>
</callout>
</callout.config>





 


我的中文能力有限, 希望能给大家解释道callout.config.xml的文件, 如有什么问题, 请到论坛上问,我会尽能力帮助大家的。

没有评论: