{Code Tip} Assigning User to Business unit using C# code in Dynamics 365

In continuation to the past blogs that I have been writing to solve some of the scenarios encountered during solution to administration area related problem. This one is a sample of the code that is required to assign user to a Business unit.

Following request can be used:

 

SetBusinessSystemUserRequest request
=
new SetBusinessSystemUserRequest
();

request.BusinessId = BUGUID;

request.UserId = USERGUID;

request.ReassignPrincipal
=
new EntityReference(
“systemuser”, USERRECORDID);

SetBusinessSystemUserResponse response =
(
SetBusinessSystemUserResponse)service.Execute(request);

 

Hope it helps and happy 365ing!

Any problem in CRM – end user,Microsoft  partner or an individual?

Problem Area – Technical, Functional, Training, Development or consulting?

I am here to help, get in touch here: Click here

ABOUT THE AUTHOR:

clip_image001

Twitterhttps://twitter.com/msdynamicsblog
LinkedInhttps://www.linkedin.com/in/deepesh-somani-00296932

Google Play Store:

https://play.google.com/store/apps/details?id=com.dynamicsofdynamicscrm.msdynamicsblog&hl=en

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s