Quantcast
Channel: CRM Development 論壇
Viewing all articles
Browse latest Browse all 10280

How to change user's businessunit programmatically in CRM 2011

$
0
0

Hi all,

Using an SSIS package in CRM 2011, I would like to change an user's businessunit. I have tried following code using SetBusinessSystemUserRequest but that need a reference to CRM.SDK.PROXY.dll, which is not working correctly with XRM.SDK.dll reference. How can I accomplish this?

// Create the request object.
SetBusinessSystemUserRequest user = new SetBusinessSystemUserRequest();

// Set the properties of the request object.
user.BusinessId = new Guid(userVariable);
SecurityPrincipal assignee = new SecurityPrincipal();
assignee.PrincipalId = new Guid(userVariable);
user.ReassignPrincipal = assignee;
user.UserId = new Guid(userVariable);

// Execute the request.
SetBusinessSystemUserResponse assigned = (SetBusinessSystemUserResponse) service.Execute(user);


Viewing all articles
Browse latest Browse all 10280

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>