This documentation is archived and is not being maintained.

SP.UserProfiles.PeopleManager.setMyProfilePicture Method (sp.userprofiles)

SharePoint 2013

Uploads and sets the user profile picture.

Last modified: June 25, 2013

Applies to: apps for SharePoint | Office 365 | SharePoint Foundation 2013 | SharePoint Server 2013

SP.UserProfiles.PeopleManager.setMyProfilePicture(picture)

picture

Type: System.IO.Stream

The binary content of an image file.

 
 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);
     }
 }

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.

Show: