Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a requirement to update user profile fields. I'm able to query the fields, of course, using the CSOM API in Javascript.

But, as per here - http://msdn.microsoft.com/en-us/library/jj163800.aspx - "Not all functionality that you find in the Microsoft.Office.Server.UserProfiles assembly is available from client APIs. For example, you have to use the server object model to create or change user profiles because they're read-only from client APIs (except the user profile picture)"

That sounds like there's no supported solution for programatically updating user profile fields.. other than a sandbox solution/aspx page with codebehind running on the server. But with sandbox solutions deprecated (and farm solutions presumably not an option because I'm on Office365), does that mean there's no way of doing this?

Re: sandbox solutions, it's something I'm avoiding at all costs; else we're literally building a solution which will stop working in one or two product releases/versions' time when the deprecated feature is actually removed.

share|improve this question
    
are you working on 365 or 2013 I can't understand –  Salvatore Di Fazio May 2 '13 at 15:59
    
Both.. Office 365 is the platform, SharePoint 2013 is the product. Which bit don't you understand? :) –  Kieren Johnstone May 2 '13 at 17:35
    
because there are two solutions. You could do that by a custom web server instead you cannot with 365... so I ask you just to understand if I figure out correct :) –  Salvatore Di Fazio May 3 '13 at 7:32
    
What are the two solutions? –  Kieren Johnstone May 3 '13 at 9:23
    
I wrong to wrote... I meant what you could do with SP 2013 you can't do with 365. BTW for SP2013 you could deploy a your web service –  Salvatore Di Fazio May 3 '13 at 9:26

2 Answers 2

I don't know, but maybe Powershell could help you. Have a look at this post: http://www.c-sharpcorner.com/uploadfile/anavijai/modify-user-profile-properties-in-sharepoint-2010-using-powershell/

He stores the changes in a xml file and pushes everything up with Powershell:

function ModifyUserProfileProperties()
{

      $site = Get-SPSite $xmlData.ModifyUserProfileProperties.URL
      $context = Get-SPServiceContext($site)
      $psm = [Microsoft.Office.Server.UserProfiles.ProfileSubTypeManager]::Get($context)
      $ps = $psm.GetProfileSubtype([Microsoft.Office.Server.UserProfiles.ProfileSubtypeManager]::GetDefaultProfileName([Microsoft.Office.Server.UserProfiles.ProfileType]::User))
      $pspm = $ps.Properties
      $xmlData.ModifyUserProfileProperties.Property | ForEach-Object{
            $property = $pspm.GetPropertyByName($_.Name)
            if($property -ne $null)
            {
                  $DisplayName=$_.DisplayName
                  $Description=$_.Description   
                  $IsSearchable=$_.IsSearchable
                  $IsAlias=$_.IsAlias
                  $property.CoreProperty.DisplayName=$DisplayName
                  $property.CoreProperty.Description=$Description                
                  $property.CoreProperty.IsSearchable = $IsSearchable
                  $property.CoreProperty.IsAlias = $IsAlias               
                  $property.CoreProperty.Commit();         
                  $property.Commit()
                  write-host -f green $_.Name property is modified successfully
            }
            else
            {
               write-host -f yellow $_.Name property does not exists
            }
      }
}
share|improve this answer

You cannot modify user profile properties using CSOM or REST but you can modify these properties using the User Profiles SOAP web service (UserProfileService.asmx)

The documentation for ModifyUserPropertyByAccountName has a managed code sample.

This blog post has a JavaScript sample which uses the SPServices jQuery plugin.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.