For integration purposes our users in Dynamics CRM need to have the same GUIDs as in the rest of our environment (several custom web apps built on ASP.NET and SQL Server 2005). But when we try to create a new Dynamics user with a certain GUID, Dynamics just ignores it and creates its own (the pattern of which leads me to believe that it’s using NEWSEQUENTIALID() internally, just as if the user was created through the UI). But for other types (contact for example) Dynamics takes the GUID with no issue.
Am I doing something wrong, or does Dynamics always ignore GUIDs on new user creation?
CrmService service = GetService();
systemuser newUser = new systemuser();
Key newUserId = new Key();
newUserId.Value = new Guid("D630FA8D-A32F-4a37-BFEF-CE36CBA29009");
// The GUID I would like Dynamics to use
newUser.systemuserid = newUserId;
Lookup bu = new Lookup();
bu.Value = new Guid("16B10365-0E18-DF11-B839-005056B60DD4");
// The correct business unit ID. Nothing to see here.
newUser.businessunitid = bu;
newUser.firstname = "John";
newUser.lastname = "Doe";
newUser.domainname = "DOMAIN\\jdoe";
// Valid AD credentials too. Names changed to protect the innocent.
Guid userId = service.Create(newUser);
Console.WriteLine("User created with GUID " + userId.ToString());
// Dynamics creates the user with a completely different GUID. :-(
Edit:
I've now asked this question on Microsoft's CRM forum as well.