Newer Version Available
CallOptions
Specifies the options needed to work with a specific client. This header is only available for use with the Partner WSDL.
API Calls
The defaultNamespace element supports the following calls: create(), merge(), queryAll(), query(), queryMore(), retrieve(), search(), update(), and upsert().
The client element supports all of the above calls, plus the following: convertLead(), login(), delete(), describeGlobal(), describeLayout(), describeTabs(), describeSObject(), describeSObjects(), getDeleted(), getUpdated(), process(), undelete(), getServerTimestamp(), getUserInfo(), setPassword(), and resetPassword().
Fields
Sample Code—C#
This sample shows how to use the CallOptions header. It sets a client ID and a developer namespace prefix, which is used to resolve field names in managed packages. Next, the sample logs the specified user in.
1public void CallOptionsSample()
2{
3 // Web Reference to the imported Partner WSDL.
4 APISamples.partner.SforceService partnerBinding;
5
6 string username = "USERNAME";
7 string password = "PASSWORD";
8
9 // The real Client ID will be an API Token provided by Salesforce
10 // to partner applications following a security review.
11 // For more details, see the Security Review FAQ in the online help.
12 string clientId = "SampleCaseSensitiveToken/100";
13
14 partnerBinding = new SforceService();
15 partnerBinding.CallOptionsValue = new CallOptions();
16 partnerBinding.CallOptionsValue.client = clientId;
17
18 // Optionally, if a developer namespace prefix has been registered for
19 // your Developer Edition organization, it may also be specified.
20 string prefix = "battle";
21 partnerBinding.CallOptionsValue.defaultNamespace = prefix;
22
23 try
24 {
25 APISamples.partner.LoginResult lr =
26 partnerBinding.login(username, password);
27 }
28 catch (SoapException e)
29 {
30 Console.WriteLine(e.Code);
31 Console.WriteLine(e.Message);
32 }
33}