When you add a user manually in office 365, you get an email with your password etc. I want to do this process via code. Currently when I add user to crmusing systemuser:
SystemUser user = new SystemUser{
DomainName = "tst1" + domain,
FirstName = "tst",
LastName = "1",
InternalEMailAddress = "test@gmail.com",
Address1_Telephone1 = "1111111",
IsSyncWithDirectory = true,
IsLicensed = true,
AccessMode = new OptionSetValue(0),
BusinessUnitId = new EntityReference
{
LogicalName = BusinessUnit.EntityLogicalName,
Name = BusinessUnit.EntityLogicalName,
Id = defaultBU.Id
}
};
It doesn't sync with office 365 and gives an error - This is not a valid Microsoft Online Services ID for this organization
How do I create the user such that its in Office 365 and password email is generated?
Very new to CRM - please help.