[英]How to create user in salesforce using Web/REST API from c#?
I am working on a WCF service where I need to sync the users from Windows Active Directory to a Salesforce account. 我正在开发一个WCF服务,我需要将用户从Windows Active Directory同步到Salesforce帐户。 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. 我尝试使用salesforce提供的Partner WSDL,但无法了解如何利用它在salesforce中创建新用户。 Please give me some pointer on how I can utilize Web/REST API to create a new user in salesforce. 请给我一些关于如何利用Web / REST API在salesforce中创建新用户的指针。 Any sample code or link which can explain it. 任何可以解释它的示例代码或链接。
For Salesforce's REST API you can use SalesforceSharp . 对于Salesforce的REST API,您可以使用SalesforceSharp 。
The sample code below will create an user on your Salesforce account: 下面的示例代码将在您的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);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.