Ejemplo n.º 1
0
        public static void GettingUserProfileProperties()
        {
            var clientContext = new ClientContext("http://svg-ronald:8080");
            var peopleManager = new Microsoft.SharePoint.Client.UserProfiles.PeopleManager(clientContext);
            var accountName   = "spdev\\administrator";

//            string[] prfProps = new string[] { "DisplayName", "Title" };
            //string[] prfProps = new string[] { "Manager", "FirstName" };


            //var usrPrfProps = new Microsoft.SharePoint.Client.UserProfiles.UserProfilePropertiesForUser(clientContext, accountName, prfProps);
            var profilePropertyValues = peopleManager.GetPropertiesFor(accountName);

            //var profilePropertyValues = peopleManager.GetMyProperties();

            clientContext.Load(profilePropertyValues);
            clientContext.ExecuteQuery();

            // Iterate through the property values.
            foreach (var property in profilePropertyValues.UserProfileProperties)
            {
                Console.Write(property.Key + ": " + property.Value + "\n");
            }
            Console.ReadKey(false);
        }
Ejemplo n.º 2
0
        public static void ChangePicture(string userAccount)
        {
            var clientContext = new ClientContext("http://svg-ronald:8080/");

            //var peopleManager = new PeopleManager();

            var peopleManager = new Microsoft.SharePoint.Client.UserProfiles.PeopleManager(clientContext);
            var personProperties = peopleManager.GetPropertiesFor(userAccount);

            clientContext.Load(personProperties);

            var sr = new System.IO.FileStream("C:/Users/Administrator/Desktop/Temp/SharePoint-2013-logo.png",FileMode.Open);
            peopleManager.SetMyProfilePicture(sr);

            clientContext.Load(peopleManager);
            clientContext.ExecuteQuery();

            //var up = upm.GetUserProfile(userAccount);
            //up.Commit();
        }
Ejemplo n.º 3
0
        public static void ChangePicture(string userAccount)
        {
            var clientContext = new ClientContext("http://svg-ronald:8080/");

            //var peopleManager = new PeopleManager();

            var peopleManager    = new Microsoft.SharePoint.Client.UserProfiles.PeopleManager(clientContext);
            var personProperties = peopleManager.GetPropertiesFor(userAccount);

            clientContext.Load(personProperties);

            var sr = new System.IO.FileStream("C:/Users/Administrator/Desktop/Temp/SharePoint-2013-logo.png", FileMode.Open);

            peopleManager.SetMyProfilePicture(sr);

            clientContext.Load(peopleManager);
            clientContext.ExecuteQuery();

            //var up = upm.GetUserProfile(userAccount);
            //up.Commit();
        }
Ejemplo n.º 4
0
        public static void GettingUserProfileProperties()
        {
            var clientContext = new ClientContext("http://svg-ronald:8080");
            var peopleManager = new Microsoft.SharePoint.Client.UserProfiles.PeopleManager(clientContext);
            var accountName = "spdev\\administrator";

            //            string[] prfProps = new string[] { "DisplayName", "Title" };
            //string[] prfProps = new string[] { "Manager", "FirstName" };

            //var usrPrfProps = new Microsoft.SharePoint.Client.UserProfiles.UserProfilePropertiesForUser(clientContext, accountName, prfProps);
            var profilePropertyValues = peopleManager.GetPropertiesFor(accountName);
            //var profilePropertyValues = peopleManager.GetMyProperties();

            clientContext.Load(profilePropertyValues);
            clientContext.ExecuteQuery();

            // Iterate through the property values.
            foreach (var property in profilePropertyValues.UserProfileProperties)
            {
                Console.Write(property.Key + ": " + property.Value + "\n");
            }
            Console.ReadKey(false);
        }