Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
Contoso.ProfileProperty.Migration.Extract
Contoso.ProfileProperty.Migration.Import Initial Checkin Jul 27, 2014
Core.ProfileProperty.Migration.sln doc updates Core.ProfileProperty.Migration Sep 14, 2014
README.md Added sample readme tracking to all components, samples and solutions. Sep 6, 2016

README.md

PROFILE PROPERTY MIGRATION

Summary

A set of migration console applications used to export single and multi-valued user profile properties from an on-premises deployment and write those properties to an intermediate store. Secondly, we then update SharePoint Online Tenant via that intermediate store.

Applies to

  • Office 365 Multi Tenant (MT)
  • Office 365 Dedicated (D)
  • SharePoint 2013 on-premises
  • SharePoint 2010

Solution

Solution Author(s)
Core.ProfileProperty.Migration Mark Franco (Microsoft)

Version history

Version Date Comments
1.0 April 3, 2014 Initial release

Disclaimer

THIS CODE IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.


General

Updating and reading of user profile properties happens via the user profile web service (userprofileservice.asmx). If you’re using Office 365 Multi-Tenant you can launch this service from the my-site host (e.g. https://contoso-my.sharepoint.com/_vti_bin/userprofileservice.asmx) or from tenant administration (e.g. https://contoso-admin.sharepoint.com/_vti_bin/userprofileservice.asmx). It’s important that if you want to update all user profile properties for all users that you use the user profile web service in combination with the tenant administration site. Typical use cases for this are:

  • These tools are architected with a simple migration mechanism (XML serialization), making the process of bringing on premises profile data to SPO a two-step process for robustness.
    • Extracting user profile information from an on premises SP2010/SP2013 environment and persist the data to disk via XML serialization. In the case of this example “Ask me about”, and “About me” Properties are used only.
    • Updating user profile properties in SPO using the import tool’s output (XML File with user profile data).

IMPORTANT: Use this capability with care as this allows you to override “system properties” such as workemail which contain data coming from Exchange Online in a typical Office 365 MT or D deployment.

EXTRACT USER PROFILE PROPERTIES FROM SP2010/SP2013

This scenario shows how to read single and multi-value user profile properties. To make this work you need to run the code on a server on your on-premises farm with farm level permissions. This tool’s code base uses server side OM. Note: the SharePoint Server does not require connectivity as we are pulling data and persisting to disk as part of a two-step process.

This scenario is handles by the Contoso.ProfileProperty.Migration.Extract, version 1.0 console application.

Note: you will have to change the following values in the app.config file to suit your environment before proceeding further:

Setting options as picture

INITIALIZATION

Step 1 We must add the reference ‘Microsoft.Office.Server.UserProfiles.dll’ so we have access to the UserProfileManager class and connect as follows:

SPServiceContext svcContext = SPServiceContext.GetContext(mySite);
UserProfileManager profileManager = new UserProfileManager(svcContext);

Step 2 Enumerate all user profiles as follows:

foreach (UserProfile spUser in profileManager)
{ … }

READ A SIMPLE USER PROFILE PROPERTY

UI of needed code

READ A COMPLEX USER PROFILE PROPERTY

UI of used code

OUTPUT

Program Output: Console application output

Output file: Output xml from solution

IMPORT USER PROFILE PROPERTIES TO SPO

This scenario shows how to user profile properties via an XML file. To make this work you need to specify tenant administration credentials: if you specify regular user credentials you’ll not be able to update the user profile properties of other users. This scenario is handled by the Contoso.ProfileProperty.Migration.Import, version 1.0 console application. Note: you will have to change the following values in the app.config file to suit your environment before proceeding further:

Configuration properties as a table

INITIALIZATION

Code for initialization

WRITE A SIMPLE USER PROFILE PROPERTY

Code for updating user profile property

WRITE A COMPLEX USER PROFILE PROPERTY

Code for updating complex user profile property

You can’t perform that action at this time.