出于集成目的,Dynamics CRM 中的用户需要具有与环境其他部分(基于 ASP.NET 和 SQL Server 2005 构建的多个自定义 Web 应用程序)中相同的 GUID。但是,当我们尝试使用特定 GUID 创建新的 Dynamics 用户时,Dynamics 只是忽略它并创建自己的用户(其模式使我相信它在内部使用 NEWSEQUENTIALID() ,就像通过 UI 创建用户一样)。但对于其他类型(例如联系人),Dynamics 可以毫无问题地获取 GUID。
我是否做错了什么,或者 Dynamics 在创建新用户时总是忽略 GUID?
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:
我现在问了这个问题在 Microsoft 的 CRM 论坛上 http://social.microsoft.com/Forums/en-US/crm/thread/109ef32c-00a2-43c3-b7bd-cc640d151ef1以及。
我知道这并不理想,但作为一种解决方法,您可以向 systemuser 实体添加自定义属性并将您的集成 ID 存储在那里。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)