Newer Version Available
LoginScopeHeader
Specifies your organization ID so that you can authenticate Self-Service users for your organization using the existing login().
API Calls
Fields
| Element Name | Type | Description |
|---|---|---|
| organizationId | ID |
The ID of the organization against which you will authenticate Self-Service users. |
| portalId | ID |
Specify only if user is a Customer
Portal user. The ID of the portal for this organization. The ID is
available in the Salesforce user
interface:
|
Sample Code—C#
This sample shows how to use the LoginScopeHeader. It sets the organization ID and the portal ID for a Customer Portal user. It also sets the CallOptions header. It then logs the specified user in.
1swfobject.registerObject("clippy.codeblock-0", "9");
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17/// Demonstrates how to set the LoginScopeHeader values.
18public void LoginScopeHeaderSample()
19{
20 // Web Reference to the imported Partner WSDL.
21 APISamples.partner.SforceService partnerBinding;
22
23 string username = "USERNAME";
24 string password = "PASSWORD";
25
26 // The real Client ID will be an API Token provided by salesforce.com
27 // to partner applications following a security review. For more details,
28 // see the Security Review FAQ in the online help.
29 string clientId = "SampleCaseSensitiveToken/100";
30
31 partnerBinding = new SforceService();
32 partnerBinding.CallOptionsValue = new CallOptions();
33 partnerBinding.CallOptionsValue.client = clientId;
34
35 // To authenticate Self-Service users, we need to set the OrganizationId
36 // in the LoginScopeHeader.
37 string orgId = "00ID0000OrgFoo";
38 partnerBinding.LoginScopeHeaderValue = new LoginScopeHeader();
39 partnerBinding.LoginScopeHeaderValue.organizationId = orgId;
40 // Specify the Portal ID if the user is a Customer Portal user.
41 string portalId = "00ID0000FooPtl";
42 partnerBinding.LoginScopeHeaderValue.portalId = portalId;
43
44 try
45 {
46 APISamples.partner.LoginResult lr =
47 partnerBinding.login(username, password);
48 }
49 catch (SoapException e)
50 {
51 Console.WriteLine(e.Code);
52 Console.WriteLine(e.Message);
53 }
54}