Мануал - из CRM SDK, там есть пример, лежит в "sdk samples\fullsample\duplicatedetection", называется readme.doc. Проверка там производится с помощью .aspx страницы, вот ее код:
Код:
<%@ Page Language="c#"%>
<%@ Import Namespace="CrmSdk" %>
<script runat="server">
protected override void Render(HtmlTextWriter writer)
{
Response.Clear();
Response.ContentType = "text/xml";
// Load the requested "name" from the querystring
string newAccountName = Request.QueryString["name"];
// Make sure the requested "name" appears valid
if (newAccountName != null &&
newAccountName.Length > 0 &&
newAccountName.Length <= 100)
{
CrmService service = new CrmService();
service.Credentials = System.Net.CredentialCache.DefaultCredentials;
QueryByAttribute attributeQuery = new QueryByAttribute();
attributeQuery.Attributes = new string [] {"name"};
attributeQuery.Values = new string [] {newAccountName};
attributeQuery.EntityName = EntityName.account.ToString();
RetrieveMultipleRequest retrieve = new RetrieveMultipleRequest();
retrieve.Query = attributeQuery;
RetrieveMultipleResponse retrieved = (RetrieveMultipleResponse)service.Execute(retrieve);
// Render the response to the caller
if (retrieved.BusinessEntityCollection.BusinessEntities.Length > 0)
{
Response.Write("<duplicatesFound>true</duplicatesFound>");
}
else
{
Response.Write("<duplicatesFound>false</duplicatesFound>");
}
}
else
{
Response.Write("<error>The Account name requested is invalid!</error>");
}
}
</script>