通过c#连接Salesforce失败
本文关键字:失败 Salesforce 连接 通过 | 更新日期: 2023-09-27 18:14:45
我正在尝试通过c#连接Salesforce api。我重置了安全令牌,并将其添加到我的密码中,然后我尝试连接。但是登录失败。我做错了什么?如有任何帮助,我将不胜感激。
登录功能: public void sForceLogin(String userName, String password)
{
try
{
currentLoginResult = sForce.login(userName, password);
}
catch (System.Web.Services.Protocols.SoapException ex)
{
Console.WriteLine("An exception has been catched:" + ex.Message);
}
}
主: SForceTest sft = new SForceTest();
sft.sForceLogin("example@example.com", "password+securitytoken");
您可以使用以下代码登录salesforce。
using (SforceService service = new SforceService()) { LoginResult loginResult = service.login(username, String.Concat(password, securityToken)); this.SessionID = loginResult.sessionId; this.ServerUrl = loginResult.serverUrl; }
Salesforce登录api需要用户名、密码和安全令牌