Retrieves a list of available objects for your organization’s data.
DescribeGlobalResult = connection.describeGlobal();
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.
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.
public void describeGlobalSample() { try { // Make the describeGlobal() call DescribeGlobalResult describeGlobalResult = connection.describeGlobal(); // Get the sObjects from the describe global result DescribeGlobalSObjectResult[] sobjectResults = describeGlobalResult.getSobjects(); // Write the name of each sObject to the console for (int i = 0; i < sobjectResults.length; i++) { System.out.println(sobjectResults[i].getName()); } } catch (ConnectionException ce) { ce.printStackTrace(); } }
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.
public void describeGlobalSample() { try { // Make the describeGlobal() call DescribeGlobalResult dgr = binding.describeGlobal(); // Get the sObjects from the describe global result DescribeGlobalSObjectResult[] sObjResults = dgr.sobjects; // Write the name of each sObject to the console
for (int i = 0; i < sObjResults.Length; i++) { Console.WriteLine(sObjResults[i].name); } } catch (SoapException e) { Console.WriteLine("An unexpected error has occurred: " + e.Message + "\n" + e.StackTrace); } }