describeGlobal()
組織のデータで利用可能なオブジェクトの一覧を取得します。
構文
1DescribeGlobalResult = connection.describeGlobal();使用方法
describeGlobal() を使用し、組織で利用可能なオブジェクトの一覧を取得します。リスト内で反復処理し、describeSObjects() を使用して個別のオブジェクトのメタデータを取得できます。
組織のデータのメタデータを取得するには、クライアントアプリケーションは条件を満たすアクセス権限でログインする必要があります。
サンプルコード — Java
このサンプルでは、describeGlobal() の実行方法を示します。次に、返された結果から sObject を取得し、その名前をコンソールに書き込みます。
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}サンプルコード — C#
このサンプルでは、describeGlobal() の実行方法を示します。次に、返された結果から sObject を取得し、その名前をコンソールに書き込みます。
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}引数
なし。
応答
DescribeGlobalResult