Profile Image Upload

Bulk uploads profile images to a my site host. Runs on the desktop by using web services and client object model to communicate with the server.

Installation

Download the zip file, extract to a directory.
Requires .NET 3.5 SP1

Using

Run the executable Com.CodePlex.SPC3.ProfileImageUpload.exe
Enter a my site url, username and password (that has manage profile permissions).
Select the authentication type.
Select the directory where the profile images are stored
Set the regex used to extract the account name from the image name (example filename: domain_username.jpg)

profileimageupload.png

Process

  • First the program validates if can connect to the my site url you provided with the authentication details
  • Then it loops over all the files in the directory you have selected
    • For each image, three resized image are created in memory
    • 144x144 (_LThumb)
    • 96x96 (_MThumb)
    • 32x32 (_SThumb)
    • Each thumbnail is then uploaded to the my site profile image directory (/User Photos/Profile Pictures)
    • Finally, the profile property PictureURL is updated with the new MThumb url

Recommendations

Have the source images in the format "domain_username.jpg"


Last edited Jan 20, 2011 at 12:17 PM by djeeg, version 7

Comments

aliz Jul 15, 2013 at 11:34 AM 
Djeeg> I've same error as many guys faced!

15.07.2013 14:11:56: Ready
15.07.2013 14:12:16: Uploading
15.07.2013 14:12:16: Validating inputs
15.07.2013 14:12:16: Connecting to site
15.07.2013 14:12:17: Processing
15.07.2013 14:12:17: Files to upload: 1
15.07.2013 14:12:17: C:\Users\user\Desktop\picfolder\MyDomain_user.JPG
15.07.2013 14:12:17: resizing 144x144
15.07.2013 14:12:18: uploading 144x144
15.07.2013 14:12:18: DoWork failed:
15.07.2013 14:12:18: Microsoft.SharePoint.Client.ServerException: list "User Photos" not found URL- "http://portal/my/personal".
at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream)
at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse()
at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryToServer(ChunkStringBuilder sb)
at Microsoft.SharePoint.Client.ClientRequest.ExecuteQuery()
at Microsoft.SharePoint.Client.ClientRuntimeContext.ExecuteQuery()
at Microsoft.SharePoint.Client.ClientContext.ExecuteQuery()
at Com.CodePlex.SPC3.ProfileImageUpload.SharePointDAO.UploadDocument(String siteurl, String username, String password, String authtype, String listname, String listfolder, String name, Byte[] data)
at Com.CodePlex.SPC3.ProfileImageUpload.ProfileImageUploadManager.Process(UploadArgs args, BackgroundWorker worker)
at Com.CodePlex.SPC3.ProfileImageUpload.MainWindow.<>c__DisplayClass4.<btnUpload_Click>b__1(Object sender, DoWorkEventArgs e)
15.07.2013 14:12:18: Done

have you any recommendations to fix it!?
and can you tell me please how can i do same work for sharepoint 2013 platform?
thanks in advance!!

nikhiil Nov 29, 2012 at 5:17 PM 
Worked Perfectly. Thanks !!

ebrinkman Apr 24, 2012 at 3:53 PM 
At first start i had the issue with the different language. I changed the names of the list and subdir to User Photos and Profile Pictures and the first picture is uploaded fine. After that i reveiced an error:

24-4-2012 16:35:19: Failed to modify profile property.
24-4-2012 16:35:19: System.Web.Services.Protocols.SoapException: Bewerkingsfout ---> Attempted to perform an unauthorized operation.
bij System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
bij System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
bij Com.CodePlex.SPC3.ProfileImageUpload.userprofileservice.UserProfileService.ModifyUserPropertyByAccountName(String accountName, PropertyData[] newData)
bij Com.CodePlex.SPC3.ProfileImageUpload.SharePointDAO.UpdateProfileProperty(String siteurl, String username, String password, String authtype, String accountname, String field, String value)
bij Com.CodePlex.SPC3.ProfileImageUpload.ProfileImageUploadManager.Process(UploadArgs args, BackgroundWorker worker)

When i read this error it seems that the account i used to upload the pictures with doesn't have the proper rights on the User Profile Service Ap. But the problem is, the user does have those rights. It is administrator on the service application....?

The other issue i am facing: not all the users have there profile> Before going live i would like to have created all user profiles and uploaded all pictures. Any ideas on that one?

hangyee86 Feb 21, 2012 at 10:11 AM 
This is really a great tool. However, I got an issue which my domain name like domain\firstname.lastname, the tools just take domain\firstname to search and it cannot find the user at the end. How to handle others special characters as well like backslash or single quote.

Regards,
Vinz

xlar54 Jan 6, 2012 at 12:52 AM 
Errors if the user doesnt exist. Need to be able to upload even if the user hasnt created a mysites account yet.

gjgiraldo Dec 6, 2011 at 8:26 PM 
The solution is to change the title of the document library to User Photos, and works.
gabriel giraldo
www.gjgsoftware.com

tbarnett Nov 2, 2011 at 7:27 AM 
Hi, I'm receiving the following error:

2/11/2011 4:09:55 PM: Uploading
2/11/2011 4:09:55 PM: Validating inputs
2/11/2011 4:09:55 PM: Connecting to site
2/11/2011 4:09:55 PM: Processing
2/11/2011 4:09:55 PM: Files to upload: 1
2/11/2011 4:09:55 PM: C:\Users\john.graham\Pictures\Ozcare Profiles\abc_john.graham.jpg
2/11/2011 4:09:55 PM: resizing 144x144
2/11/2011 4:09:55 PM: uploading 144x144
2/11/2011 4:09:56 PM: DoWork failed:
2/11/2011 4:09:56 PM: Microsoft.SharePoint.Client.ServerException: File Not Found.
at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream)
at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse()
at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryToServer(ChunkStringBuilder sb)
at Microsoft.SharePoint.Client.ClientRequest.ExecuteQuery()
at Microsoft.SharePoint.Client.ClientRuntimeContext.ExecuteQuery()
at Microsoft.SharePoint.Client.ClientContext.ExecuteQuery()
at Com.CodePlex.SPC3.ProfileImageUpload.SharePointDAO.UploadDocument(String siteurl, String username, String password, String authtype, String listname, String listfolder, String name, Byte[] data)
at Com.CodePlex.SPC3.ProfileImageUpload.ProfileImageUploadManager.Process(UploadArgs args, BackgroundWorker worker)
at Com.CodePlex.SPC3.ProfileImageUpload.MainWindow.<>c__DisplayClass4.<btnUpload_Click>b__1(Object sender, DoWorkEventArgs e)
2/11/2011 4:09:56 PM: Done

I have checked the My Site - All Site Content and under the "Picture Libraries" section there is a library "User Photos" and within this, is a folder named "Profile Pictures". The folder, "Profile Pictures", already contains the existing profile images from images which were uploaded via the individual my site pages. I have also tried created a picture library called "Profile Pictures" 1 level up, i.e. at the same level as the "User Photos", but the error is still occurring.

I'm not sure what is causing the error, so if anyone can shed some light on this that would be greatly appreciated.

Cheers

browncow Oct 19, 2011 at 3:42 PM 
The images are appearing under profiles now, but it appears that the organization browser no longer works. Any suggestions or is it just a coincidence and its another problem?

herrnikolov666 Aug 28, 2011 at 12:39 PM 
Thank you for the great application.
I’ve upload image for AD users with no problem, but now I want to upload profile image for Forms Based Authentication users, but the account names for this users are in this format:
i:0#.f|membership|username
If it is possible could you tell me how to do it?
I’ve played with the Filename format (Regex), but was not successful.

jduser Aug 24, 2011 at 1:55 AM 
Hi, thanks for making this available. I just wanted to mention some hurdles (btw hurdles I created since the path required is stated above under process) I experienced using this on a test site.

First error I got was User Photos doesn't exist or something to that effect. Problem was I hadn't set up the My Sites properly. I used this article to set up on my test server. (http://technet.microsoft.com/en-us/library/ee624362.aspx). Once it was setup correctly I could see the User Photos list in the my sites site collection.

Second error was 24/08/2011 10:18:48 AM: uploading 144x144
24/08/2011 10:18:57 AM: DoWork failed:
24/08/2011 10:18:57 AM: Microsoft.SharePoint.Client.ServerException: File Not Found.

This was because the folder "Profile Pictures" that it was looking for hadnt been created for some reason, so I created that one and I was able to upload/resize the images fine.

Thanks again for the utility, it definitely will make my life easier

remb0 May 25, 2011 at 7:43 PM 
My situation:
we are currently running sharepoint 2007 and use the AD field: wwwHompage to populate with pictures: http://sharepoint/ and then a picture list.
That worked for us in 2007. We have the mysite enabled. I Have installed 2010 and will complete the migration.

My problem:
But in 2010 I want to map the field picture to wwwHompage but I can't change that field in user profile properties.
I cannot delete the property of edit it.

the url to the picture is stored in the publib website field.
And the photo's in the sharepoint picturelibarie are named: adusername_jpg.jpg

What are my options, whatis the best I can do?
Can I do something to map it right? Or can I download the pictures from my libary and use this tool?
I'm not a programmer and try to do my best to report this question here.
I don't understand the egex field used in this tool.

hjd May 14, 2011 at 1:27 PM 
Hi, seems to a great app, but is not running on my German SP2010 Server! It looks like only to be running on English SP2010, right?
In my German SP2010 it throws the following error:

14.05.2011 14:22:56: Ready
14.05.2011 14:23:21: Uploading
14.05.2011 14:23:21: Validating inputs
14.05.2011 14:23:21: Connecting to site
14.05.2011 14:24:49: Processing
14.05.2011 14:24:49: Files to upload: 5
14.05.2011 14:24:49: T:\MA-Fotos\moss3_hjd.jpg
14.05.2011 14:24:49: resizing 144x144
14.05.2011 14:24:50: uploading 144x144
14.05.2011 14:24:51: DoWork failed:
14.05.2011 14:24:51: Microsoft.SharePoint.Client.ServerException: Die Liste 'User Photos' ist in der Website mit der URL 'http://vm-sp2010-b-sta:30200' nicht vorhanden.
bei Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream)
bei Microsoft.SharePoint.Client.ClientRequest.ProcessResponse()
bei Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryToServer(ChunkStringBuilder sb)
bei Microsoft.SharePoint.Client.ClientRequest.ExecuteQuery()
bei Microsoft.SharePoint.Client.ClientRuntimeContext.ExecuteQuery()
bei Microsoft.SharePoint.Client.ClientContext.ExecuteQuery()
bei Com.CodePlex.SPC3.ProfileImageUpload.SharePointDAO.UploadDocument(String siteurl, String username, String password, String authtype, String listname, String listfolder, String name, Byte[] data)
bei Com.CodePlex.SPC3.ProfileImageUpload.ProfileImageUploadManager.Process(UploadArgs args, BackgroundWorker worker)
bei Com.CodePlex.SPC3.ProfileImageUpload.MainWindow.<>c__DisplayClass4.<btnUpload_Click>b__1(Object sender, DoWorkEventArgs e)
14.05.2011 14:24:51: Done

This may be due to the fact, that in German SP2010 the list with the images is named "Benutzerfotos" instead of "User Photos", although the URL of this list is identical to the English version. I tentatively changed the name of the list from "Benutzerfotos" to "User Photos" in my SP2010 and we got one step further! But now got another error, same as described by "hismail"!

How to get it running for German SharePoint 2010?
Any help appriciated!

hismail May 6, 2011 at 3:02 PM 
I get this error, what am I doing wrong?

5/4/2011 6:11:53 PM: DoWork failed:
5/4/2011 6:11:53 PM: Microsoft.SharePoint.Client.ServerException: File Not Found.
at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream)
at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse()
at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryToServer(ChunkStringBuilder sb)
at Microsoft.SharePoint.Client.ClientRequest.ExecuteQuery()
at Microsoft.SharePoint.Client.ClientRuntimeContext.ExecuteQuery()
at Microsoft.SharePoint.Client.ClientContext.ExecuteQuery()
at Com.CodePlex.SPC3.ProfileImageUpload.SharePointDAO.UploadDocument(String siteurl, String username, String password, String authtype, String listname, String listfolder, String name, Byte[] data)
at Com.CodePlex.SPC3.ProfileImageUpload.ProfileImageUploadManager.Process(UploadArgs args, BackgroundWorker worker)
at Com.CodePlex.SPC3.ProfileImageUpload.MainWindow.<>c__DisplayClass4.<btnUpload_Click>b__1(Object sender, DoWorkEventArgs e)

cvhp1972 May 2, 2011 at 7:22 PM 
Would be great if you can have a 'bulk import' mode in order to do this using a file as input for instances where we already have pictures from legacy applications for users.

Thanks

kwright7878 Feb 28, 2011 at 4:51 PM 
Works great but for some reason the picture being uploaded doesn't work in the Org browser view. We are using HTTPS could that be the problem. Anyway to fix it? If we manually upload pictures the org browser works fine but with the tool it doesn't.

djeeg Feb 17, 2011 at 9:51 PM 
Andy this should be fixed now, I was not handling the case when there was no profile field

AndyBraithwaite Feb 16, 2011 at 9:20 AM 
Hi, thnx for the great app, just having some problems and have tried the suggestions re perms in http://blogs.technet.com/b/speschka/archive/2010/02/22/no-user-profile-application-available-mystery-in-sharepoint-2010.aspx

Login OK
Picture resize & upload OK

Here's the rest of the log:

16/02/2011 09:18:21: DoWork failed:
16/02/2011 09:18:21: System.IndexOutOfRangeException: Index was outside the bounds of the array.
at Com.CodePlex.SPC3.ProfileImageUpload.SharePointDAO.SelectProfileProperty(String siteurl, String username, String password, String authtype, String accountname, String field)
at Com.CodePlex.SPC3.ProfileImageUpload.ProfileImageUploadManager.Process(UploadArgs args, BackgroundWorker worker)
at Com.CodePlex.SPC3.ProfileImageUpload.MainWindow.<>c__DisplayClass4.<btnUpload_Click>b__1(Object sender, DoWorkEventArgs e)
16/02/2011 09:18:21: Done

Many thanks

Andy

djeeg Feb 5, 2011 at 3:19 AM 
i have added some error handling when the profile property is modified

bickb8 Jan 26, 2011 at 9:39 PM 
This is exactly the tool I need, however it does not work. Like the person above, the resize seems to work and uploads, but once it tries to apply the profile picture the application crashed.

spsam Jan 24, 2011 at 8:50 PM 
Okay, disregard my issue. It appears that I had a permission issue in the User Profiles Service Application. Everything is working now and profile images are now populated. To fix my issue, I followed the following - http://blogs.technet.com/b/speschka/archive/2010/02/22/no-user-profile-application-available-mystery-in-sharepoint-2010.aspx Great tool and keep up the good work.

spsam Jan 24, 2011 at 6:43 PM 
This appears to be a great tool, but when I execute the upload, I see that the first image is uploaded successfully, but then the application crashes. I am using an account with the appropriate permissions and I have mysites configured properly. Any idea what else my cause an issue. I have tried from my desktop and the server, both returning the same result.

Configuration: SharePoint 2010 Ent. - 1 WFE Server (2008 R2), 1 Application Server (2008 R2), 2 Node MSCS SQL 2008 R2 Failover Cluster. Images are jpg, naming convention domain_username.jpg.

Thanks. Again great app, just having some trouble.