No Results
Search Tips:
- Please consider misspellings
- Try different search keywords
LoginScopeHeader
組織 ID を指定し、既存の login() コールを使用して組織のセルフサービスユーザを認証できるようにします。
API コール
項目
サンプルコード —C#
このサンプルでは、LoginScopeHeader の使用方法を示します。カスタマーポータルユーザの組織 ID とポータル ID を設定します。また、CallOptions ヘッダーを設定します。次に、指定されたユーザをログインします。
1swfobject.registerObject("clippy.codeblock-0", "9");/// Demonstrates how to set the LoginScopeHeader values.
2public void LoginScopeHeaderSample()
3{
4 // Web Reference to the imported Partner WSDL.
5 APISamples.partner.SforceService partnerBinding;
6
7 string username = "USERNAME";
8 string password = "PASSWORD";
9
10 // The real Client ID will be an API Token provided by salesforce.com
11 // to partner applications following a security review. For more details,
12 // see the Security Review FAQ in the online help.
13 string clientId = "SampleCaseSensitiveToken/100";
14
15 partnerBinding = new SforceService();
16 partnerBinding.CallOptionsValue = new CallOptions();
17 partnerBinding.CallOptionsValue.client = clientId;
18
19 // To authenticate Self-Service users, we need to set the OrganizationId
20 // in the LoginScopeHeader.
21 string orgId = "00ID0000OrgFoo";
22 partnerBinding.LoginScopeHeaderValue = new LoginScopeHeader();
23 partnerBinding.LoginScopeHeaderValue.organizationId = orgId;
24 // Specify the Portal ID if the user is a Customer Portal user.
25 string portalId = "00ID0000FooPtl";
26 partnerBinding.LoginScopeHeaderValue.portalId = portalId;
27
28 try
29 {
30 APISamples.partner.LoginResult lr =
31 partnerBinding.login(username, password);
32 }
33 catch (SoapException e)
34 {
35 Console.WriteLine(e.Code);
36 Console.WriteLine(e.Message);
37 }
38}