Apex Code:
public Class RemovePhotoFromUserRecord {
public static void removePhoto() {
//Replace 2nd parameter with the required userId. Right now I am doing it for loggedin user
ConnectApi.UserProfiles.deletePhoto(null,userInfo.getUserId());
}
}
Output: call RemovePhotoFromUserRecord.removePhoto() from anonymous window of developer console.
You may observe the photo gets deleted.
public Class RemovePhotoFromUserRecord {
public static void removePhoto() {
//Replace 2nd parameter with the required userId. Right now I am doing it for loggedin user
ConnectApi.UserProfiles.deletePhoto(null,userInfo.getUserId());
}
}
Output: call RemovePhotoFromUserRecord.removePhoto() from anonymous window of developer console.
You may observe the photo gets deleted.