So a while ago, writing User Profile properties via the CSOM was made possible. Vesa Juvonen has a great post about it here:
http://blogs.msdn.com/b/vesku/archive/2014/11/07/sharepoint-user-profile-properties-now-writable-with-csom.aspx
I have put together some code which will allow a Tenant Administrator to modify the User Profile Properties of another user in the tenant. This could be useful if a batch job has to be performed and profile properties have to be set (or updated) for all the users in a Tenant. The code is only to set the properties of one user but you can easily modify it to do the same for multiple users.
This code can also be found as a part of the Office 365 Patterns and Practices code samples on GitHub:
https://github.com/OfficeDev/PnP/tree/dev/Samples/UserProfile.Manipulation.CSOM.Console/
You will need the AccountName of the user whose profile properties you want to modify. To get the AccountName of all the user's in a Tenant, you can use People search.
Some points to note with this approach:
1) You need to know the credentials of the Tenant Admin
2) I have tried using this code in a Provider Hosted App with App Only Policy but it does not seem to work. It only works in a Console Application for now.
3) This is only available in SharePoint Online for now and not SharePoint 2013 On-Premises.
4) You will need the 16.0.0.0 version of the following libraries:
Microsoft.SharePoint.Client.dll
Microsoft.SharePoint.Client.Runtime.dll
Microsoft.SharePoint.Client.UserProfiles.dll
The code:
http://blogs.msdn.com/b/vesku/archive/2014/11/07/sharepoint-user-profile-properties-now-writable-with-csom.aspx
I have put together some code which will allow a Tenant Administrator to modify the User Profile Properties of another user in the tenant. This could be useful if a batch job has to be performed and profile properties have to be set (or updated) for all the users in a Tenant. The code is only to set the properties of one user but you can easily modify it to do the same for multiple users.
This code can also be found as a part of the Office 365 Patterns and Practices code samples on GitHub:
https://github.com/OfficeDev/PnP/tree/dev/Samples/UserProfile.Manipulation.CSOM.Console/
You will need the AccountName of the user whose profile properties you want to modify. To get the AccountName of all the user's in a Tenant, you can use People search.
Some points to note with this approach:
1) You need to know the credentials of the Tenant Admin
2) I have tried using this code in a Provider Hosted App with App Only Policy but it does not seem to work. It only works in a Console Application for now.
3) This is only available in SharePoint Online for now and not SharePoint 2013 On-Premises.
4) You will need the 16.0.0.0 version of the following libraries:
Microsoft.SharePoint.Client.dll
Microsoft.SharePoint.Client.Runtime.dll
Microsoft.SharePoint.Client.UserProfiles.dll
The code: