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() call4 DescribeGlobalResult describeGlobalResult = 5 connection.describeGlobal();67 // Get the sObjects from the describe global result8 DescribeGlobalSObjectResult[] sobjectResults = 9 describeGlobalResult.getSobjects();1011 // Write the name of each sObject to the console12 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 try4 { 5 // Make the describeGlobal() call 6 DescribeGlobalResult dgr = binding.describeGlobal();78 // Get the sObjects from the describe global result9 DescribeGlobalSObjectResult[] sObjResults = dgr.sobjects;1011 // Write the name of each sObject to the console12 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}