2013-10-29 149 views
5

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

+2

顺便说一句,你可以直接在[salesforce.stackexchange.com(http://salesforce.stackexchange.com问Salesforce的问题/) – mast0r

回答

2

对于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 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); 
相关问题