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

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

Programmatically Uploading User Profile Pictures using Powershell

Posted By:      Posted Date: September 16, 2010    Points: 0   Category :SharePoint
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

View Complete Post

More Related Resource Links

Programmatically Upload Pictures to SharePoint Profile Picture Store using Powershell


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

Configure Synchronization connections with PowerShell (User Profile)

Hi, I was checking the Pshell cmdlets for SPS2010 and wasn't able to configure the sync connection after creating the User Profile SA. Do you know if it's possible to configure this part (AD, filters, etc) in PShell ? Is it done using the "SetupSynchronizationService" method of the User Profile Service Application object ? Thanks ! Wes  

Moved MySites. Now suddenly while Search finds the user profile pictures, user profile pictures don'


We did an architectural change and moved MySites by creating a new MySite host, assigning it to the User Profile Service application and then deleting the old MySite host.

I'd like to avoid recreating the User Profile Service application. Is it possible to fix this UPS issue (I assume it's an UPS issue), without recreating UPS?

Creating User Profile Service application and proxy using PowerShell

Hi All,

Not sure if anybody have tried creating a new user profile service application and user profile service aplication proxy using PowerShell?

I am able to create the user profile service application using the following cmdlet:

-ApplicationPool "SharePoint Web Services Default"
-Name "Demo Profile User Service"
-MySiteHostLocation http://demo2010a:80/my
-ProfileDBName UserProfile_ProfileDB_Demo
-ProfileSyncDBName UserProfile_SyncDB_Demo
-SocialDBName UserProfile_SocialDB_SyncDB

I was also not able to supply the MySite Host Relative Path (-MySiteRelativePath) and MySites have not been set up for the user profile application. And again, get-help lists MySiteRelativePath as a valid parameter, but when executed, PowerShell throws that the parameter is invalid. 

I am unable to create  a new proxy for the above created user profile service application using the cmdlet:


The cmdlet keeps asking for parameter Uri which seems to be undocumented.

Would be glad if anyone can help out here.

SharePoint Developer - MCTS SharePoin

Programmatically adding user profile properties fails when adding a multivalued property


I have written a console application that adds a custom section to the User Profile Properties and then adds properties under that section. The code works fine when adding CoreProperties of type string (Single Value) and mapping each property to an Active Directory field. However the code always fails when mapping a string (Multi Value) property to an AD property. I have researched the errors I present below but cannot see what the solution might be.


    private static void AddCustomProperties(string strUrl)
      Console.WriteLine("Adding custom properties under section '" + DisplayName + "'.......");
      using (SPSite siteColl = new SPSite(strUrl))

        SPServiceContext serviceContext = SPServiceContext.GetContext(siteColl);
        UserProfileConfigManager upcm = new UserProfileConfigManager(serviceContext);
        CorePropertyManager cpm = upcm.ProfilePropertyManager.GetCoreProperties();
        ProfilePropertyManager ppm = up

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)

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?!

Not able to edit user profile in share point


Hi ,

I am new to share point, and not able to edit user profile data in sharepoint2007. I am getting an error "can't edit the property try with user profile services".

I have ran full crawl still getting the same problem. Also let me know how I can fetch data from Active Directory to share point 2007.



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



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)

SharePoint BDC - User Profile - 1:Many

Hi everyone, sorry for the long post, but I thought it'd be better to give all the information just in case there's a better way to do this. Basically, here's our scenario, we have a requirement to have Customers searchable in the people search (as in which employee sells to which customers).  We have a sql database with 3 tables: - employees(columns: userid, username, displayname); - customers(columns: customerid, customername); and - employeecustomer(columns userid, customerid) - we also have one view UserCustomer(columns: username, customername) So we've tried to create the BDC Applciation Definition on the view.  Here is the Entity Portion of the Application Definition file: <Entity EstimatedInstanceCount="10000" Name="EmployeeCustomer"> <Properties> <Property Name="Title" Type="System.String">username</Property> </Properties> <Identifiers> <Identifier Name="customer_name" TypeName="System.String" /> <Identifier Name="username" TypeName="System.String" /> </Identifiers> <Methods> <Method Name="Get_EmployeeCustomer_List"> <Properties> <Property Name="RdbCommandText" Type="System.String"><![CDATA[SELECT custo

Profile User Synchronisation Service

Hi, I have a problem to open Profile User Synchronisation. It doesn' work, I tried to verify this problem by opening services.msc but It show an error when I try to restart the service : Error 1068 The service or the groupe of dependency can't be restarted.   Thanks

User profile in Windows 7

I have Windows Server 2003 and when attaching my Windows 7 Professional machine, it will not create the profile. When logging on it loads a temporary file.  I tried changing to local profile but it will not let select it.  Any suggestions would be greatly appreciated.

User Profile Service account Write to AD Permissions

I followed this guide here (http://www.harbar.net/articles/sp2010ups.aspx) to provision the UPS service in sharepoint 2010. I found the guide very helpful and informative. Everything is working correctly except for the write back to AD I've followed the steps and have assigned the listed permissions to the UPS service account, however I still get permissiong errors in the FIM GUI Our AD is running in a 2008 environment but is in 2003 mode, so I made sure to add the UPS account to Pre Windows 2000 Compatible access built in group and restart the server so that the new group settings would take affect. Do I need to reprovision the UPS service or something? Or am I missing something completely. (Hopefully the latter lol!) Thanks RKB

User Profile Application Failing in SharePoint 2010 (14.0.4514.1004)

I keep getting the following error "This User Profile Application's connection is currently not available. The Application Pool or User Profile Service may not have been started. Please contact your administrator.". As sugested by Travis at http://blogs.pointbridge.com/Blogs/nielsen_travis/pages/default.aspx I tried commenting the two security nodes, removing its' allowInsecureTransport attributes, and setting then False. As Lionel wrote in his comment I tried also modifying "Central Administration / Application Management / Configure service application associations / Application Proxy Group" of my share point web application. My application pool for User Profile Service Application seems working and User Profile Service status is Started.One thing I remember about my issue, first I tried creating User Profile Service Application I got some error message and tried creating User Profile Service Application again. It gave me some other exception and than I navigated somehow to the "Manage service applications" page and there the desired User Profile Service Application was magically on the list with status Started. I thought - that's great! But when I clicked the User Profile Service Application link I got the nasty red error I mentioned at the beginning. Any ideas?Regards,Dawid Ireno

Customize the User Profile page

I need to add a "link" or "button" to the User Profile page (userdisp.aspx).  In SP2007, I had a custom feature that would forward the user to a custom aspx page, but that doesn't appear to work in 2010.  Is there a recommended method of customizing the User Profile page in 2010?

Retrieving user profile

I am trying to retrieve the user profile details using UserProfileManager class on MOSS 2007 installed machine. I tried with AccountName property using SystemAccount\UserName and  also I passed into  GUID of the known user profile into GetUserProfile method. still I am getting this exception User Not Found: Could not load profile data from the database. any idea?
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