CRM 3.0 SDK Contact Merge

I'm using the following code, which is pretty much right out of the sdk documentation example:

Dim targetAsNew TargetMergeContact

Dim mergeReqAsNew MergeRequest

target.EntityId = contactCRM(Pri).contactid.Value

mergeReq.SubordinateId = contactCRM(Sec).contactid.Value

mergeReq.Target = target

Dim mergedAs MergeResponse =CType(crm.Execute(mergeReq), MergeResponse)

I get a "Server was unable to process the request." error on the last line. I am using an account with System Administrator privileges. I have verified that I can write contact information using the SDK, so this problem is merge specific.

Is there a way that merging could be disabled? If so, how do I enable it?

[1592 byte] By [MattMasotti] at [2008-2-27]
# 1

"More detailed" error:

<error> <code>0x80040203</code> <description>Invalid argument.</description> <type>Platform</type> </error>

I have also verified that the guid's are correct and are being properly assigned to both target and mergeReq.

MattMasotti at 2007-10-2 > top of Msdn Tech,Microsoft ISV Community Center Forums,Architecture, Tools, and Process for ISVs...
# 2
This has got to be an SDK bug. I can run the same code for accounts and it works. Has anyone come across this problem? I have all recent updates on the CRM installation. Real frustrating.
MattMasotti at 2007-10-2 > top of Msdn Tech,Microsoft ISV Community Center Forums,Architecture, Tools, and Process for ISVs...
# 3

Matt;

You must set the UpdateContent property of the MergeRequest for the code to work.

The latest version of the SDK release has the correct sample code.

// Create the request.

MergeRequest merge = new MergeRequest();

// SubordinateId is the GUID of the account merging.

merge.SubordinateId = new Guid("AD618DB2-F0DB-4A6A-8C4B-2F2213EAA38E");

merge.Target = target;

merge.PerformParentingChecks = false;

account updateContent = new account();

updateContent.address1_line1 = "test";

merge.UpdateContent = updateContent;

// Execute the request.

MergeResponse merged = (MergeResponse)service.Execute(merge);

You can find the sample code online at http://msdn2.microsoft.com/en-us/library/aa682826.aspx.

TechWriter at 2007-10-2 > top of Msdn Tech,Microsoft ISV Community Center Forums,Architecture, Tools, and Process for ISVs...
# 4
Actually, the problem was that you cannot merge a contact if the ownerid is part of the merge. It works for accounts, but with contacts you have to make sure that the ownerid is not part of the fields used in the merge - you have to specify your own set of fields to use and exclude it.
MattMasotti at 2007-10-2 > top of Msdn Tech,Microsoft ISV Community Center Forums,Architecture, Tools, and Process for ISVs...