예제 #1
0
        /// <summary>
        /// Use this function is in a single call to SPO you want to set multiple profile properties. 1st item in propertyname array is associated to first item in propertvalue array etc
        /// </summary>
        /// <param name="UserName"></param>
        /// <param name="PropertyName"></param>
        /// <param name="PropertyValue"></param>
        static void SetMultipleProfileProperties(string UserName, string[] PropertyName, string[] PropertyValue)
        {

            LogMessage("Setting multiple SPO user profile properties for " + UserName, LogLevel.Information);

            try
            {
                int arrayCount = PropertyName.Count();

                UPSvc.PropertyData[] data = new UPSvc.PropertyData[arrayCount];
                for (int x = 0; x < arrayCount; x++)
                {
                    data[x] = new UPSvc.PropertyData();
                    data[x].Name = PropertyName[x];
                    data[x].IsValueChanged = true;
                    data[x].Values = new UPSvc.ValueData[1];
                    data[x].Values[0] = new UPSvc.ValueData();
                    data[x].Values[0].Value = PropertyValue[x];
                }

                _userProfileService.ModifyUserPropertyByAccountName(UserName, data);
                //LogMessage("Finished setting multiple SPO user profile properties for " + UserName, LogLevel.Information);

            }
            catch (Exception ex)
            {
                LogMessage("User Error: Exception trying to update profile properties for user " + UserName + "\n" + ex.Message, LogLevel.Error);
            }
        }
예제 #2
0
        /// <summary>
        /// Use this function if you want to set a single property in the user profile store
        /// </summary>
        /// <param name="UserName"></param>
        /// <param name="PropertyName"></param>
        /// <param name="PropertyValue"></param>
        static void SetSingleProfileProperty(string UserName, string PropertyName, string PropertyValue)
        {

            try
            {


                UPSvc.PropertyData[] data = new UPSvc.PropertyData[1];
                data[0] = new UPSvc.PropertyData();
                data[0].Name = PropertyName;
                data[0].IsValueChanged = true;
                data[0].Values = new UPSvc.ValueData[1];
                data[0].Values[0] = new UPSvc.ValueData();
                data[0].Values[0].Value = PropertyValue;
                _userProfileService.ModifyUserPropertyByAccountName(UserName, data);


            }
            catch (Exception ex)
            {
                LogMessage("Exception trying to update profile property " + PropertyName + " for user " + UserName + "\n" + ex.Message, LogLevel.Error);
            }

        }
예제 #3
0
 /// <remarks/>
 public void ModifyUserPropertyByAccountNameAsync(string accountName, PropertyData[] newData) {
     this.ModifyUserPropertyByAccountNameAsync(accountName, newData, null);
 }
예제 #4
0
 /// <remarks/>
 public void ModifyUserPropertyByAccountNameAsync(string accountName, PropertyData[] newData, object userState) {
     if ((this.ModifyUserPropertyByAccountNameOperationCompleted == null)) {
         this.ModifyUserPropertyByAccountNameOperationCompleted = new System.Threading.SendOrPostCallback(this.OnModifyUserPropertyByAccountNameOperationCompleted);
     }
     this.InvokeAsync("ModifyUserPropertyByAccountName", new object[] {
                 accountName,
                 newData}, this.ModifyUserPropertyByAccountNameOperationCompleted, userState);
 }
예제 #5
0
 public void ModifyUserPropertyByAccountName(string accountName, PropertyData[] newData) {
     this.Invoke("ModifyUserPropertyByAccountName", new object[] {
                 accountName,
                 newData});
 }