You can do this - here's an example I put together and tested via anonymous apex for another thread I was helping on:
Profile p = [select id from Profile where name='Chatter Free User'];
User u = new User(alias = 'utest', email='Unit.Test@unittest.com',
emailencodingkey='UTF-8', firstName='First', lastname='Last', languagelocalekey='en_US',
localesidkey='en_US', profileid = p.id,
timezonesidkey='Europe/London', username='Unit.Test@unittest.com');
insert u;
You can do this - here's an example I put together and tested via anonymous apex for another thread I was helping on:
thnx its working fine..
i cant find user license field there ??
it by defaults create salesforse license user ...cant we change license ??
The license is tied to the profile - choose a profile that has that particular license type.
Thanks !! got it...
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_system.htm
This has reset and set password capabilities.