示例#1
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            ConfigurationManager  manager = ConfigurationManager.GetInstance(Session);
            UserConfigurationList userConfigurationList = new UserConfigurationList(manager);
            UserConfiguration     user = userConfigurationList.CreateObject();

            user.PrepareForEdit();

            #region define User Properties
            //define i3 UserId
            user.SetConfigurationId(UserId);

            //define first and last name for user profile
            user.PersonalInformation.GivenName.Value = GivenName;
            user.PersonalInformation.Surname.Value   = Surname;

            //define NT Username
            if (!String.IsNullOrEmpty(NTDomainName))
            {
                user.NtDomainUser.Value = (NTDomainName);
            }

            //define extension
            if (!String.IsNullOrEmpty(Extension))
            {
                user.Extension.Value = Extension;
            }

            //define outband ani
            if (!String.IsNullOrEmpty(OutbandANI))
            {
                user.OutboundAni.Value = OutbandANI;
            }


            //define default workstation
            if (!String.IsNullOrEmpty(DefaultWorkstation))
            {
                user.DefaultWorkstation.Value = new ConfigurationId(DefaultWorkstation);
            }

            //define Department name
            if (!String.IsNullOrEmpty(Department))
            {
                user.PersonalInformation.DepartmentName.Value = Department;
            }

            //define Job Title
            if (!String.IsNullOrEmpty(JobTitle))
            {
                user.PersonalInformation.Title.Value = JobTitle;
            }

            //define fax capability
            if (!String.IsNullOrEmpty(FaxCapability))
            {
                if (FaxCapability.ToLower() == "enable")
                {
                    user.FaxCapability.Value = true;
                }
            }

            //define password policy
            if (PasswordPolicy != null)
            {
                foreach (string pwPolicy in PasswordPolicy)
                {
                    user.PasswordPolicies.Value.Add(new ConfigurationId(pwPolicy));
                }
            }
            #endregion

            user.Commit();
        }