Created
November 29, 2013 11:55
-
-
Save vman/7704688 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Microsoft.SharePoint.Client; | |
| using Microsoft.SharePoint.Client.UserProfiles; | |
| using System; | |
| using System.IO; | |
| using System.Security; | |
| namespace ImgSetter | |
| { | |
| class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| using (ClientContext clientContext = new ClientContext("https://yoursite.sharepoint.com/")) | |
| { | |
| SecureString passWord = new SecureString(); | |
| foreach (char c in "yourpassword".ToCharArray()) passWord.AppendChar(c); | |
| clientContext.Credentials = new SharePointOnlineCredentials("[email protected]", passWord); | |
| var peopleManager = new PeopleManager(clientContext); | |
| System.IO.Stream stream = new FileStream(@"C:\imgToSetAsProfilePic.jpg",FileMode.Open); | |
| peopleManager.SetMyProfilePicture(stream); | |
| clientContext.ExecuteQuery(); | |
| Console.WriteLine("Profile Picture Set"); | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment