5

I am working on a WCF service where I need to sync the users from Windows Active Directory to a Salesforce account. I don't want to use any 3rd party tool or service, but want to develop a new one. I tried to use Partner WSDL provided by salesforce, but couldn't get how I can utilize it to create a new user in salesforce. Please give me some pointer on how I can utilize Web/REST API to create a new user in salesforce. Any sample code or link which can explain it.

1

1 Answer 1

4

For Salesforce's REST API you can use SalesforceSharp.

The sample code below will create an user on your Salesforce account:

var client = new SalesforceClient();
var authenticationFlow = new UsernamePasswordAuthenticationFlow
(clientId, clientSecret, username, password);

client.Authenticate (authenticationFlow);

var user = new 
{
    Username = "[email protected]",
    Alias =  "userAlias",
    // The ID of the user profile (Standard User, System Administrator, etc).
    ProfileId = "00ei000000143vq", 
    Email = "[email protected]",
    EmailEncodingKey = "ISO-8859-1",
    LastName = "lastname",
    LanguageLocaleKey = "pt_BR",
    LocaleSidKey = "pt_BR",
    TimeZoneSidKey = "America/Sao_Paulo"
};

var id = client.Create ("User", user);
Sign up to request clarification or add additional context in comments.

1 Comment

For profileID, where did you get 00ei000000143vq? I am trying to create a user and not sure where to generate that at...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.