Groups > Application developers > Community Server Source discussions > Re: Creating a new user in code




Creating a new user in code

Creating a new user in code
Mon, 25 Sep 2006 17:08:43 +000
I having a problem creating new users as part of a CSJob I've created.  The
problem is that I get a NullReference exception when I create the user. The code
in question is as follows:

Dim usr As New User

usr.AccountStatus = UserAccountStatus.Approved
usr.Username = "Delgeate123443"
usr.EnableDisplayName = True
usr.Email = "tester1@ptpprograms.org"
 
Try
     Users.Create(usr, False)
Catch ex As Exception
     Throw ex
End Try


Any thoughts?
Post Reply
Re: Creating a new user in code
Mon, 25 Sep 2006 17:41:09 +000
Please set a password for user to see what will happen.
Post Reply
Re: Creating a new user in code
Mon, 25 Sep 2006 21:05:33 +000
I tried that, and got the same error.  The error seems to be occuring in the
data provider. I'm going to look at the source code and see what I can find
out.
Post Reply
Re: Creating a new user in code
Tue, 26 Sep 2006 17:21:44 +000
I figured it out. IsAnonymous needs to be set to true.
Post Reply
Re: Creating a new user in code
Tue, 26 Sep 2006 17:50:16 +000
Nice
Post Reply
about | contact