Click here to Skip to main content
15,899,124 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C#
User[] AddUser = new User[1];

User objuser = new User 
{
    Username = "EMAIL_REMOVED@gmail.com",
    Alias = "Balu",
    // The ID of the user profile (Standard User, System Administrator, etc).
    ProfileId = "00590000002Px2qAAC",
    Email = "EMAIL_REMOVED@gmail.com",
    EmailEncodingKey = "ISO-8859-1",
    FirstName="Balaji",
    LastName = "Balu",
    LanguageLocaleKey = "pt_BR",
    LocaleSidKey = "pt_BR",
    TimeZoneSidKey = "America/Sao_Paulo"
};
AddUser[0] = objuser;

SaveResult[] saveResults = _service.create(AddUser);

string result = "";

if (saveResults[0].success)
{
    result = "The update of Lead ID " + saveResults[0].id + " was succesful";
}
else
{
    MessageBox.Show(saveResults[0].errors[0].message);
    //result = "There was an error updating the Lead. The error returned was " + saveResults[0].errors[0].message;
}



[Edit member="Tadit"]
Email ID removed.
[/Edit]
Posted
v4

1 solution

In above code I am Passing Id instead of Passing ProfileID
I changed the code Now it's working fine for me any doubts contact me balaji.balumca@gmail.com

User[] AddUser = new User[1];

User objuser = new User
{
Username = "EMAIL_REMOVED@gmail.com",
Alias = "Balu",
// The ID of the user profile (Standard User, System Administrator, etc).
ProfileId = "00e90000001CcTnAAK",
Email = "EMAIL_REMOVED@gmail.com",
EmailEncodingKey = "ISO-8859-1",
FirstName="Balaji",
LastName = "Balu",
LanguageLocaleKey = "pt_BR",
LocaleSidKey = "pt_BR",
TimeZoneSidKey = "America/Sao_Paulo"
};
AddUser[0] = objuser;

SaveResult[] saveResults = _service.create(AddUser);

string result = "";

if (saveResults[0].success)
{
result = "The update of Lead ID " + saveResults[0].id + " was succesful";
}
else
{
MessageBox.Show(saveResults[0].errors[0].message);
//result = "There was an error updating the Lead. The error returned was " + saveResults[0].errors[0].message;
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900