Newer Version Available
describeGlobal()
Retrieves a list of available objects for your organization’s data.
Syntax
1DescribeGlobalResult = connection.describeGlobal();Usage
Use describeGlobal() to obtain a list of available objects for your organization. You can then iterate through this list and use describeSObjects() to obtain metadata about individual objects.
Your client application must be logged in with sufficient access rights to retrieve metadata about your organization’s data. For more information, see Factors that Affect Data Access.
Sample Code—Java
This sample shows how to perform a global describe. It then retrieves the sObjects from the global describe result and writes their names to the console.
1swfobject.registerObject("clippy.codeblock-1", "9");
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17public void describeGlobalSample() {
18 try {
19 // Make the describeGlobal() call
20 DescribeGlobalResult describeGlobalResult =
21 connection.describeGlobal();
22
23 // Get the sObjects from the describe global result
24 DescribeGlobalSObjectResult[] sobjectResults =
25 describeGlobalResult.getSobjects();
26
27 // Write the name of each sObject to the console
28 for (int i = 0; i < sobjectResults.length; i++) {
29 System.out.println(sobjectResults[i].getName());
30 }
31 } catch (ConnectionException ce) {
32 ce.printStackTrace();
33 }
34}Sample Code—C#
This sample shows how to perform a global describe. It then retrieves the sObjects from the global describe result and writes their names to the console.
1swfobject.registerObject("clippy.codeblock-2", "9");
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17public void describeGlobalSample()
18{
19 try
20 {
21 // Make the describeGlobal() call
22 DescribeGlobalResult dgr = binding.describeGlobal();
23
24 // Get the sObjects from the describe global result
25 DescribeGlobalSObjectResult[] sObjResults = dgr.sobjects;
26
27 // Write the name of each sObject to the console
28 for (int i = 0; i < sObjResults.Length; i++)
29 {
30 Console.WriteLine(sObjResults[i].name);
31 }
32 }
33 catch (SoapException e)
34 {
35 Console.WriteLine("An unexpected error has occurred: " +
36 e.Message + "\n" + e.StackTrace);
37 }
38}Arguments
None.