如何使用c#中的Web/REST API在salesforce中创建用户?

Nit*_*shi 5 c# rest salesforce

我正在开发一个WCF服务,我需要将用户从Windows Active Directory同步到Salesforce帐户.我不想使用任何第三方工具或服务,但想开发一个新工具或服务.我尝试使用salesforce提供的Partner WSDL,但无法了解如何利用它在salesforce中创建新用户.请给我一些关于如何利用Web/REST API在salesforce中创建新用户的指针.任何可以解释它的示例代码或链接.

gia*_*lli 4

对于 Salesforce 的 REST API,您可以使用 SalesforceSharp

下面的示例代码将在您的 Salesforce 帐户上创建一个用户:

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

client.Authenticate (authenticationFlow);

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

var id = client.Create ("User", user);
Run Code Online (Sandbox Code Playgroud)