Newer Version Available

This content describes an older version of this product. View Latest

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. .

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.

1public void describeGlobalSample() {
2    try {
3        // Make the describeGlobal() call
4        DescribeGlobalResult describeGlobalResult = 
5            connection.describeGlobal();
6        
7        // Get the sObjects from the describe global result
8        DescribeGlobalSObjectResult[] sobjectResults = 
9            describeGlobalResult.getSobjects();
10        
11        // Write the name of each sObject to the console
12        for (int i = 0; i < sobjectResults.length; i++) {
13          System.out.println(sobjectResults[i].getName());
14        }
15    } catch (ConnectionException ce) {
16        ce.printStackTrace();
17    }
18}

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.

1public void describeGlobalSample()
2{
3    try
4    {               
5        // Make the describeGlobal() call 
6        DescribeGlobalResult dgr = binding.describeGlobal();
7
8        // Get the sObjects from the describe global result
9        DescribeGlobalSObjectResult[] sObjResults = dgr.sobjects;
10
11        // Write the name of each sObject to the console
12        for (int i = 0; i < sObjResults.Length; i++)
13        {
14            Console.WriteLine(sObjResults[i].name);
15        }
16    }
17    catch (SoapException e)
18    {
19        Console.WriteLine("An unexpected error has occurred: " +
20            e.Message + "\n" + e.StackTrace);
21    }
22}

Arguments

None.

Response

DescribeGlobalResult