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