0

I want to add an User Content of Sensenet from a client which developed by .NET.

Please give me a solution.

Thanks so much.

dinhienhy
  • 15
  • 6

1 Answers1

1

You should be able to create users the same way as any other content, by providing the parent, the content type name and a few mandatory fields.

The example below assumes that you already initialized the client, you have the /Root/IMS/MyDomain/MyOrgUnit in your repo and there is no existing user there with the same name.

var user = Content.CreateNew("/Root/IMS/MyDomain/MyOrgUnit", "User", "johnsmith");
user["LoginName"] = "johnsmith"; // best practice: same as the content name in the line above
user["Password"] = "123456789";
user["FullName"] = "John Smith";
user["Email"] = "johnsmith@example.com"; // this has to be unique under the domain
user["Enabled"] = true; // to let the user actually log in
await user.SaveAsync();

Let us know if you encounter any errors.

Miklós Tóth
  • 1,490
  • 13
  • 19