I have an external-facing SharePoint site that uses a .Net membership database to house claims user accounts. I'm attempting to build a solution in C# that creates a new user account in the database and (so far) coming up short.
For instance, imagine I have a "Create User" button on the ribbon and when someone clicks that button I want the following to happen:
- solution logs in to the account database using hard-coded credentials
- solution creates a new account using a variable from the page as the login name
- solution generates a random password for the account
- solution places the account in a hard-coded SharePoint group on the site
Seems easy enough on the face of it, but I'm running into issues accessing the database and creating new rows in multiple tables. I've added the database to my solution as a data source, but that may not be the correct method. Several articles indicate adding the database as a membership provider, but I don't need to authenticate against the existing accounts, just create a new one. Unfortunately, that act seems to touch multiple tables at once when done through the GUI.
What would be the correct method in C# for accessing the database and creating a new user account? Assume either a web form application or a SharePoint feature solution.

0 commentaires:
Enregistrer un commentaire