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?
Keyvan NayyeriWaegis Anti-Spam Filter - Stay Away from Spams on Your Community Server Sites
Hi Guys,
I am attempting to create a cs2007 user as part of a job and I am getting the following exception:
Object reference not set to an instance of an object
and my code looks like this:
{
user.AccountStatus = CommunityServer.Components.
user.Password =
user.IsAnonymous =
}
Is there something that I have to do in order to be allowed to execute this code?
Thanks,
Matt
sorry for the double post... :'(
Just a question... Is there any particular reason you are setting IsAnonymous to true? Just because it makes it work in some instances doesn't mean that it should necessarily be done. What if the user doesn't want to be anonymous?Perhaps you could take a peak at the CreateUserForm...I believe you might want to set IsAnonymous -> False, AccountStatus -> UserAccountStatus.Approved,
rfritts:Just a question... Is there any particular reason you are setting IsAnonymous to true? Just because it makes it work in some instances doesn't mean that it should necessarily be done. What if the user doesn't want to be anonymous?Perhaps you could take a peak at the CreateUserForm...I believe you might want to set IsAnonymous -> False, AccountStatus -> UserAccountStatus.Approved,
Thanks mate,
It seems it was as simple as setting the IsAnonymous to false and it all worked!
Copyright© 2008 Telligent Systems Inc. All rights reserved CommunityServer.com • Telligent.com