/ Published in: C#
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
//get a handle on our sites and web(s) SPWeb Web = Site.OpenWeb(); //get a handle on our current users (if any): SPUserCollection users = Web.AllUsers; //add the new user (see my snippet on getting users from Active Directory, which comes in handy here) users.Add("<login name>", "<email address>", "<name>", "<notes>"); //no need to do an .update() //you can now return this user as an SPUser: SPUser newUser = users["<login name>"];