【问题标题】:How to create user in salesforce using Web/REST API from c#?如何使用 c# 中的 Web/REST API 在 Salesforce 中创建用户?
【发布时间】:2013-12-01 05:59:50
【问题描述】:

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

【问题讨论】:

标签: c# rest salesforce


【解决方案1】:

对于 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);

【讨论】:

  • 对于 profileID,你从哪里得到 00ei000000143vq?我正在尝试创建一个用户,但不确定在哪里生成...
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-09-29
  • 2022-10-20
  • 1970-01-01
  • 1970-01-01
  • 2017-10-23
  • 1970-01-01
相关资源
最近更新 更多