SP.UserProfiles.PeopleManager.setMyProfilePicture Method (sp.userprofiles)
Uploads and sets the user profile picture.
Applies to: apps for SharePoint | Office 365 | SharePoint Foundation 2013 | SharePoint Server 2013
SP.UserProfiles.PeopleManager.setMyProfilePicture(picture)
Parameters
picture
Type: System.IO.StreamThe binary content of an image file.
Example
import System.IO;
function Start () {
var dirs : DirectoryInfo[] = new DirectoryInfo("/Users/name").GetDirectories();
var sw : StreamWriter = new System.IO.StreamWriter("DriveDirs.txt");
sw.WriteLine("Found the following folder:");
for (var dir : DirectoryInfo in dirs){
sw.WriteLine(dir.Name);
}
sw.Close();
var sr : StreamReader = new System.IO.StreamReader("DriveDirs.txt");
Debug.Log(sr.CurrentEncoding);
var line : String;
while (!sr.EndOfStream) {
line = sr.ReadLine();
Debug.Log(line);
}
}
Remarks
Pictures in BMP, JPEG, and PNG formats of up to 5 million bytes are supported. A user can only upload a picture to their own profile.