Dynamics CRM:使用特定的GUID创建用户 [英] Dynamics CRM: Create users with specific GUIDs

查看:119
本文介绍了Dynamics CRM:使用特定的GUID创建用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

出于集成目的,我们Dynamics CRM中的用户需要具有与我们其余环境(几个基于ASP.NET和SQL Server 2005构建的自定义Web应用程序)相同的GUID。但是,当我们尝试使用特定的GUID创建新的Dynamics用户时,Dynamics只会忽略它并创建自己的用户(该模式使我相信它在内部使用NEWSEQUENTIALID(),就像该用户是通过UI创建的一样)。但是对于其他类型(例如,联系人),Dynamics毫无问题地采用了GUID。

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.

我做错了什么,还是Dynamics在创建新用户时总是忽略GUID?

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. :-(

编辑:

我现在已经问了这个问题也在Microsoft的CRM论坛上

I've now asked this question on Microsoft's CRM forum as well.

推荐答案

我知道这并不理想,但是一种解决方法是,您可以向systemuser实体添加自定义属性,然后在其中存储您的集成ID。

I know it is not ideal, but as a workaround you could add a custom attribute to the systemuser entity and store your integration id there.

这篇关于Dynamics CRM:使用特定的GUID创建用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆