.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Programmatically Upload Pictures to SharePoint Profile Picture Store using Powershell

Posted By:      Posted Date: October 11, 2010    Points: 0   Category :SharePoint

I'm trying to create a powershell script that will bulk upload pictures to the SharePoint Profile Picture Store located in a "http://sp2010/my/User Photos/Profile Pictures".  I found Chris Johnson's blog post ( http://blogs.msdn.com/b/cjohnson/archive/2010/05/08/sharepoint-2010-office-2010-and-profile-pictures.aspx )  extremely useful.  However, the SPUtils.ps1 that is referenced on his site doesn't seem to support uploading to the "Profile Pictures" folder within the "User Photos" picture library at "http://sp2010/my/User Photos".  My account has full control of the "User Photos" picture library and the "Profile Pictures" folder, and I can upload to the "User Photos", root directory with no problems.  The file fails to upload to the "Profile Pictures" folder.

Currently my Powershell script processes a folder of pictures.  First, it pulls the file name and does some manipulations to retrieve the employee number of the employee.  Second, it performs an active directory search to get the employee's user name.  Third, it resizes the photo to match the small, medium, and large thumbnails generated by a traditional manual upload of a photo from the user's edit profile page.  After each creation of the resized picture it uploads the picture t

View Complete Post

More Related Resource Links

Programmatically Uploading User Profile Pictures using Powershell

I've reviewed other solutions for this, but I need clarification on something I'm not getting by reading other posts.  I'm using a powershell script to: 1)  Upload profile pictures on our network into the User Photos picture library in the My Site Host.  This works. 2) Associate a picture to a user profile.  I'm using this command ... $up.get_Item($picturePropertyName).Value = $PortraitUrl ... where $up is the user profile, $picturePropertyName is the property name of the url (PictureUrl), and $PortraitUrl is the full path to the picture uploaded in point 1 above.  This isn't working. 3) Eventually I will be executing the Update-SPProfileStore command to automatically resize the images once they've been added. Clarification required ... when I associate a picture to the user profile in step 2 above, is this what will automatically generate the 3 thumbnails for me (in the Profile Picture folder)?  Or ... do I have to manually create the 3 images?  Or ... will it associate the image I've provided and then the Update-SPProfileStore command will create the 3 resized images for me? I notice that when I associate a picture to a profile using the 'Edit my Profile' UI, it automatically creates the thumbnails for me.  I'm just not understanding how these pieces fit together.  I see some code snippets out there for r

Upload Profile Picture using PowerShell



We have 2 requirement

First, to update the each profile picture programmatically with powershell. We are able to update the picture property of a profile,

Second, we need to create a picture library in their User profile and upload the picture from the document library(Which has a list of image of Employee) and set that path to the profile picture url.

we are not able to create the document library in the User profile. Its throwing error message as "Access Deined". Through Object Model we are able to achieved it throught SPSecurity.RunWithElevatedPriliveige. But throught PowerShell we dont know how to achieve this.

Please Suggest how to achieve this.

Note: We are Using SharePoint 2007 Server.


Ganesh Moorthy S

Profile Pictures not displayed in Discussion Board in SharePoint 2007

Picture Placeholders are displayed instead of Profile Images in Discussion boards in MOSS 2007 but when you click on the user, their pictures appeared in MySites, also with Search People. How to fix this?!

Sharepoint 2010: Editing My Profile:Choose Picture gives errors

Hi, I've got the User Profile Service Application up and running.  When I try to add my picture to my Profile by clicking on the Choose Picture button, it gives an error.  Any ideas?   Thanks.

Profile Pictures in SharePoint 2010



One of my customer needs to use profile pictures in SharePoint, Outlook and Office communicator, but he doesn't want the pictures to be replicated in Active Directory.

Could any of you let me know if this is possible? If yes, please let me know how to proceed on this.




Exporting SharePoint profile picture to ActiveDirectory thumbnailPhoto attribute problem!



I am trying to export SharePoint profile Picture to ActiveDirectory thumbnailPhoto attribute.  Here's what I did so far :

  • FIM account has Replicating Directory Changes, Read and Write permissions on the users OU
  • Central Administration -> Manage service applications -> User Profile Service Application -> Manage User Properties -> Picture -> Edit -> Add New Mapping -> AD - thumbnailPhoto - export
  • Start Profile Synchronization
  • Result :

Stage SharePoint Server export
Additions 0
Updates 0
Unchanged 0
Successes 0
Failures 0

I have then found on the Internet that since My Sites are in https, I have to load the root certificate in SharePoint.  I use a "GeoTrust DV SSL CA" for My Sites so I have downloaded the GeoTrust_Global_CA.cer root certificate from GeoTrust and did the following :

  • Central Administration -> Security -> Manage Trust -> New -> GeoTrust - GeoTrust_Global_CA.cer
  • Result :

The Root Certificate that was just selected is inv

Uploading a profile picture in sharepoint 2010 through visual studio



  Is it possible to upload a profile picture in sharepoint2010(mysite) through visual studio(C#) ?'

   If so Could you please share the code.

thanks in advance,




User Profile Picture Mapping - Use existing SharePoint image library?


In SharePoint 2007 we did not use the Profile Pictures, but would like to start using them.  At the time, a consultant set up a separate picture library for the employee photos that was managed by the HR department.  Is it possible to somehow map the Profile Picture property to the images in this library?  Or do we have to upload them to each user's profile?  Our AD administrators do not know how to set AD up to use the URLs, so coming at it from that angle was a dead end.


Export SharePoint List to Excel Spreadsheet Programmatically using C#

In SharePoint applications, Custom Lists are used to store business data and Document Libraries to store the documents. But for data manupulation and analysis, Microsoft Excel provides very rich features as compared to SharePoint Lists. That's why people still loves to work on Microsoft Excel Sheets.

Upload a File to a SharePoint Document Library - Part I

The following helper class demonstrates a few techniques that allow documents to be uploaded to a SharePoint document library programmatically without using the API or a custom web service. You don't need to specify a document library name, and it will create any folders specified in the URL as required. File meta data will be updated if any properties are passed.

Configuring Profile Image Export in SharePoint 2010

It's no secret that I am thrilled with the new social features of SharePoint 2010. I am most excited about the new Profile Picture handling. I strongly believe that the more we can show the faces of our colleagues to one another the more connected we will feel. Clearly Microsoft feels that way as witnessed by the many features that make use of the Profile Image like the Activity Feed and Colleagues list

Extended MySite: Profile picture uploading to the wrong zone.

I'm experiencing a problem where uploading a profile picture, in a MySite, uploads it to the wrong zone.

What I've done is created one web application and configured SSP to use that same one. As a result, the MySite host location is in that same web application:

Default Zone:
http://my.domain.com  <-- default SharePoint site.
http://my.domain.com/personal <-- MySite host

I then extended that web application to enable FBA & anonymous access:

Internet Zone:
http://extended.domain.com <-- extended default SharePoint site.

Now I"m able to navigate to a user's MySite using the extended URL (http://extended.domain.com/personal)...but when I upload a new profile picture in my MySite... it prompts me for new credentials because it's trying to upload to the Default zone (http://my.domain.com).

I found the following thread that talks about this...but there wasn't any resolution:

What is the best practices when configuring a MySite in an extended web application? How can I fix the situation I'm encountering above?

P.S. I tried to change the MySite Host location (via SSP in the Central Administration)

Programmatically retrieve data from the associated row in SharePoint and use the data to do math


I am trying to pull all of the associated data from a SharePoint list row to an InfoPath form repeating table.  I would like to select 1 unique value from the row and have the other fields auto-populate with the associated data from that row. 


SharePoint Columns and also names of InfoPath fields 1, 2, 3, 4, 5, 6, 7.

I have a dropdown that is connected to column 1 and I would like to select 1 and have it populate the rest of the fields from that row.  I am currently doing this with information and C# code from:  http://www.bizsupportonline.net/infopath2007/sharepoint-list-retrieve-value-same-row-repeating-table-infopath

Programmatically Changing the Profile Provider at Runtime


Dear All

I'm using one application but have multiple providers in my web.config for memberships, roles and profiles to allow my application to be used by different groups of users who need to connect to different databases.

This means I'm having to change the membership, role and profile providers on-the-fly in my code-behind files. So far I've taken care of the membership and roles a bit like this:

Dim RolePV As RoleProvider = Roles.Providers(GetSettingFromFile("Provider"))

However, I'm having trouble finding out how to do the same sort of thing for Profiles. I've looked at ProfileProvider and ProfileManager but I can't work it out how to access my the profile property that I've created in my web.config file called "ScreenSize". Normally you would just write Profile.ScreenSize to read or write to the property.

Please can you help me to understand how I access the profile property called ScreenSize by dynamically setting the profile provider first?

I'd be very grateful for any help or advice.

Many thanks



Video: SharePoint 2010 Integration with PowerShell

Learn about the new PowerShell integration in SharePoint 2010, which brings SharePoint administration in line with other server products such as Exchange. Understanding PowerShell is a must-have skill for SharePoint 2010 developers. (Length: 19:52)

question on attachments/document upload in SharePoint

Scenario: I have business need where I need to attach some documents to a document library. My users fill out a form, which is a custom List Form in a list called "Request" but on the same form I want to provide my users a document upload feature which will save the document to a document library called "Request Documents".

In other words, request information such as Title, Department, Description etc get saved to "Request List" (SharePoint List) whereas the documents attached/uploaded (if there are any from the user) while filling the same request form out, get saved in the "Request Documents" (SharePoint Document Library) with the same ID #. If Request ID was 100, then the uploaded document(s) in the Document Library should also be 100.

I tried a few techniques out, and I'm reading some more on Data Source Library of SharePoint but I believe I need some help from the community before I do anything further.

Programmatically creating a SharePoint Site based on user input


I am working on developing a “Create Website Wizard” for SharePoint 2007 that would do the following (I am simplifying a little for the sake of this post):


1.      Take user input as follows:



Product Code:

Category (I, II, III):

The category will be a choice field (radio buttons or a dropdown)

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend