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

Sending
User Review
0 (0 votes)

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