Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            UserProfileManager upm = new UserProfileManager();

            // Office 365 Multi-tenant sample
            upm.User = "******";
            upm.Password = GetPassWord();
            upm.TenantAdminUrl = "https://bertonline-admin.sharepoint.com";
            string userLoginName = "i:0#.f|membership|[email protected]";

            // On-premises or Office 365 Dedicated sample
            //string userLoginName = @"SET1\KevinC";
            //upm.User = "******";
            //upm.Password = GetPassWord();
            //upm.Domain = "SET1";
            //upm.MySiteHost = "https://sp2013-my.set1.bertonline.info";

            Console.Write(String.Format("Value of {0} for {1} :", "AboutMe", userLoginName));
            Console.WriteLine(upm.GetPropertyForUser<String>("AboutMe", userLoginName));
            Console.WriteLine("-----------------------------------------------------");
            Console.WriteLine("");
            Console.Write(String.Format("Value of {0} for {1} :", "SPS-LastKeywordAdded", userLoginName));
            Console.WriteLine((upm.GetPropertyForUser<DateTime>("SPS-LastKeywordAdded", userLoginName)).ToLongDateString());
            Console.WriteLine("-----------------------------------------------------");
            Console.WriteLine("");
            Console.WriteLine(String.Format("Set value of {0} for {1} to {2}:", "AboutMe", userLoginName, "I love using Office AMS!"));
            upm.SetPropertyForUser<String>("AboutMe", "I love using Office AMS!", userLoginName);
            Console.WriteLine("");
            Console.Write(String.Format("Value of {0} for {1} :", "AboutMe", userLoginName));
            Console.WriteLine(upm.GetPropertyForUser<String>("AboutMe", userLoginName));
            Console.WriteLine("-----------------------------------------------------");            
            Console.WriteLine("");
            //nl-BE,fr-BE,en-US,de-DE
            Console.Write(String.Format("Value of {0} for {1} :", "SPS-MUILanguages", userLoginName));
            UserProfileASMX.PropertyData p = upm.GetPropertyForUser("SPS-MUILanguages", userLoginName);
            Console.WriteLine(p.Values[0].Value.ToString());
            Console.WriteLine("");
            Console.WriteLine(String.Format("Set value of {0} for {1} to {2}:", "SPS-MUILanguages", userLoginName, "nl-BE,en-US"));
            UserProfileASMX.PropertyData[] pMui = new UserProfileASMX.PropertyData[1];
            pMui[0] = new UserProfileASMX.PropertyData();
            pMui[0].Name = "SPS-MUILanguages";
            pMui[0].Values = new UserProfileASMX.ValueData[1];
            pMui[0].Values[0] = new UserProfileASMX.ValueData();
            pMui[0].Values[0].Value = "nl-BE,en-US";
            pMui[0].IsValueChanged = true;
            upm.SetPropertyForUser("SPS-MUILanguages", pMui, userLoginName);
            Console.WriteLine("-----------------------------------------------------");
            Console.WriteLine("");

            Console.ReadLine();
        }
Ejemplo n.º 2
0
 /// <remarks/>
 public void ModifyUserPropertyByAccountNameAsync(string accountName, PropertyData[] newData) {
     this.ModifyUserPropertyByAccountNameAsync(accountName, newData, null);
 }
Ejemplo n.º 3
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);
 }
Ejemplo n.º 4
0
 public void ModifyUserPropertyByAccountName(string accountName, PropertyData[] newData) {
     this.Invoke("ModifyUserPropertyByAccountName", new object[] {
                 accountName,
                 newData});
 }