I need to create a considerable number of form based authentication users. I have an Excel spread sheet containing user names and email addresses. I have no permission to execute code directly on farm servers. And I'm not authorized to execute any server side code. Therefore I cannot use SharePoint Server Model. I'm limited to SharePoint Client Object Model. So please.

How to create form based authentication users using client object model?

Is it even possible?


I tried this code, but obviously it doesn't work:

var context = new ClientContext("http://sp2013/sites/test");
var parameters = new UserCreationInformation() {
    Email = "[email protected]",
    LoginName = "jesuslpm",
    Title = "Jesús López"
var user = context.Web.SiteUsers.Add(parameters);

It throws ServerException

The user does not exist or is not unique

I cannot find a way to specify forms authentication nor the password for the user.

I searched the web, but everything is using server side code.

  • Did you ever find a solution for doing this? I have the same requirement on a project.
    – Omegacron
    May 3, 2018 at 18:31
  • @Omegacron. Sorry, I didn't find a solution. May 4, 2018 at 9:28

2 Answers 2


You can't do it with CSOM.

From msdn:

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). Also, there's no client-side access to some namespaces, such as Microsoft.Office.Server.Audience, Microsoft.Office.Server.ReputationModel, or Microsoft.Office.Server.SocialData. To see what's supported functionality for the client APIs, see Microsoft.SharePoint.Client.Social and Microsoft.SharePoint.Client.UserProfiles.

  • Thanks for your response. Is there a way to create FBA users from the client side?. I'm afraid there is not, but I'm asking anyway. Feb 27, 2015 at 18:29

You are using FBA - but what is the authentication source? Is it SQL, AD LDS, or another mechanism. Typically it is just SQL, with which you have a few options. If it's ADLDS - you can script it using LDAP.

There are a few methods you can use to call SQL server remotely. If you want to keep this inside SharePoint you can hook up BCS to talk to your user databases and then use CSOM to interact with data. I don't have specific examples of this working - but it's just SQL like any other external data source. Here is a link to the CSOM page for BCS on MSDN: https://msdn.microsoft.com/en-us/library/office/jj164116.aspx

The other option is to use PowerShell.Courtesy of Mr. Don Jones: https://technet.microsoft.com/en-us/magazine/hh855069.aspx

function Invoke-DatabaseQuery {
    param (
    if ($isSQLServer) {
        Write-Verbose 'in SQL Server mode'
        $connection = New-Object-TypeName System.Data.SqlClient.SqlConnection
    } else {
        Write-Verbose 'in OleDB mode'
        $connection = New-Object-TypeName System.Data.OleDb.OleDbConnection
    $connection.ConnectionString = $connectionString
    $command = $connection.CreateCommand()
    $command.CommandText = $query

You use the above in the following manner:

Invoke-DatabaseQuery –query "DELETE FROM MyTable" –isSQLServer –connectionString "Data Source=SERVER1\SQLEXPRESS;Initial Catalog=MyDatabase;User Id=myLogin;Password=P@ssw0rd"

In your case I would wrap the above in a foreach

$userCSV = Import-CSV "<path to CSV>"
foreach($user in $userCSV){
    <Place your DB access function call in here>

NOTE: Both of these assume you have the proper permissions to make these changes. This is also just referencing adding users to your data store. Once they are added you still need to assign access rights to them in SharePoint.

  • Thanks for your response. The problem is I cannot access database server. I only have site collection administration permission Feb 27, 2015 at 18:16
  • I'm not the SharePoint web farm guy nor the database guy. And the sharepoint web farm guys and the database guys won't run scripts for me. Anannoying enterprise policies are the culprit. Feb 27, 2015 at 18:24
  • The authentication source is SQL. It is ASP NET SQL membership provider. Feb 27, 2015 at 18:32
  • How are users added today? Without leveraging one of the above either direclty or thru delegated credential (BCS) you can't accomplish what you are trying to do. Feb 27, 2015 at 18:35
  • FBA pack (sharepoint2013fba.codeplex.com) is installed on the web farm. It add some web parts and application pages to manage FBA users (blogs.technet.com/b/ptsblog/archive/2013/09/20/…) . We use those application pages to add FBA users. Feb 27, 2015 at 18:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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