Programmatically change a members Name, Login and Password
Hi I'm creating a batch of members from an SQL Recordset using the following:
//Assign the standard Member TypeMemberTypemytype=MemberType.GetByAlias("WebsiteUser");//Create the MemberMembermyNewMember=Member.MakeNew(myMemberRow["loginname"].ToString(),myMemberRow["email_address"].ToString(),mytype,newumbraco.BusinessLogic.User(3));//Assign the standard Member Group (role)MemberGroupmyGroup=MemberGroup.GetByName("Standard");myNewMember.AddGroup(myGroup.Id);
I'm then getting and assigning the values of the properties (one's that I've created) such as:
But I can't seem to be able to 'get' or set the values for the Name, Login and Password. Doe's anybody know the syntax that I should be using? Whenever I try something like:
I get an error of Object Reference not set to an instance of an object, which seems to suggest that the property isn't called what I think it's called!
Using MembermyNewMember=Member.MakeNew(myMemberRow["loginname"].ToString(),myMemberRow["email_address"].ToString exposes the 'standard' properties of the member object! So I can just use
Programmatically change a members Name, Login and Password
Hi I'm creating a batch of members from an SQL Recordset using the following:
I'm then getting and assigning the values of the properties (one's that I've created) such as:
But I can't seem to be able to 'get' or set the values for the Name, Login and Password. Doe's anybody know the syntax that I should be using? Whenever I try something like:
I get an error of Object Reference not set to an instance of an object, which seems to suggest that the property isn't called what I think it's called!
Any help would be gratefully received :)
Thanks,
Craig
Hi turns out that I'm a bit of a dingbat!
Using MembermyNewMember=Member.MakeNew(myMemberRow["loginname"].ToString(),myMemberRow["email_address"].ToString exposes the 'standard' properties of the member object! So I can just use
myNewMember.Password = "mypassword" (or whatever).
Just thought that I'd post this just in case someone else confuses themselves into oblivion!!
Craig
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.