1

I am using Sitecore 10.1, there is a business requirements to allow external system to add CM users to Sitecore so my question is:

  • Is there an API that we can access to add the users in Sitecore?

4 Answers 4

1

Creating a custom API will work for you. Where you can write this logic to create user into Sitecore database. Here is a code snippet that you can refer to.

System.Web.Security.Membership.CreateUser(domain\user, "password", "[email protected]");

For example

System.Web.Security.Membership.CreateUser(@"sitecore\myuser", "b", "[email protected]");

Hope this helps.

1

Sitecore provides RESTful APIs for Item manipulation but there is NO native API to create user in Sitecore.

You will need custom API for same.

1

Sitecore uses the standard ASP.NET Membership provider for its users so you can create users with custom API calls.

userName = string.Format(@"{0}\{1}", domain, userName);
Membership.CreateUser(userName, password, email);

You can create your custom API using this code sample. Programmatically Add/Edit Users

Hope it helps!

1

In my project, I encountered a similar necessity, wherein an external system required the creation of users within Sitecore. To address this, I developed an API facilitating the seamless creation of users from the external system directly into Sitecore.

This is a code which you can use:

string userNameWithDomain = "extranet\\myuser";
string password = "somepassword";
string email = "[email protected]";
Membership.CreateUser(userNameWithDomain, password, email);

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.