[アーティクル]
10/31/2023
9 人の共同作成者
フィードバック
この記事の内容
名前空間: microsoft.graph
このorganizationの組織の連絡先 の一覧を取得します。
この API は、次の国内クラウド展開 で使用できます。
グローバル サービス
米国政府機関 L4
米国政府機関 L5 (DOD)
21Vianet が運営する中国
✅
✅
✅
✅
アクセス許可
この API の最小特権としてマークされているアクセス許可またはアクセス許可を選択します。 アプリで必要な場合にのみ 、より高い特権のアクセス許可またはアクセス許可を使用します。 委任されたアクセス許可とアプリケーションのアクセス許可の詳細については、「 アクセス許可の種類 」を参照してください。 これらのアクセス許可の詳細については、 アクセス許可のリファレンスを参照してください 。
アクセス許可の種類
最小特権アクセス許可
特権の高いアクセス許可
委任 (職場または学校のアカウント)
OrgContact.Read.All
Directory.Read.All、Directory.ReadWrite.All
委任 (個人用 Microsoft アカウント)
サポートされていません。
サポートされていません。
アプリケーション
OrgContact.Read.All
Directory.Read.All、Directory.ReadWrite.All
HTTP 要求
GET /contacts
オプションのクエリ パラメーター
このメソッドは、応答のカスタマイズに$count
$filter
$expand
$orderby
役立つ、、$search
、$select
、および$top
OData クエリ パラメーターをサポートします。 クエリの中には、ConsistencyLevel ヘッダーの設定を eventual
および $count
に使用した場合にのみサポートされるものもあります。 詳細については、「ディレクトリ オブジェクトの詳細クエリ機能 」を参照してください。
ヘッダー
値
Authorization
ベアラー {token}。 必須です。 認証と承認 の詳細については、こちらをご覧ください。
ConsistencyLevel
最終的。 このヘッダーと $count
は、$search
を使用する場合、または $filter
の特別な使用をする場合に必要です。 ConsistencyLevel と $count
の使用の詳細については、「ディレクトリ オブジェクトに対する高度なクエリ機能 」を参照してください。
要求本文
このメソッドには、要求本文を指定しません。
応答
成功した場合、このメソッドは 200 OK
応答コードと、応答本文の orgContact オブジェクトのコレクションを返します。
例
要求
次の例は要求を示しています。
GET https://graph.microsoft.com/v1.0/contacts
// Code snippets are only available for the latest version. Current version is 5.x
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Contacts.GetAsync();
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
//other-imports
)
graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
contacts, err := graphClient.Contacts().Get(context.Background(), nil)
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
OrgContactCollectionResponse result = graphClient.contacts().get();
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
<?php
use Microsoft\Graph\GraphServiceClient;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$result = $graphServiceClient->contacts()->get()->wait();
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
from msgraph import GraphServiceClient
graph_client = GraphServiceClient(credentials, scopes)
result = await graph_client.contacts.get()
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
応答
次の例は応答を示しています。
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
HTTP/1.1 200 OK
Content-type: application/json
{
"value": [
{
"companyName": "Contoso",
"department": "Marketing",
"displayName": "Eric S",
"givenName":"Eric",
"jobTitle":"Accountant",
"mail":"erics@contoso.com",
"mailNickname":"erics",
"surname":"Solomon",
"addresses":[
{
"city":"MyCity",
"countryOrRegion":"United States",
"officeLocation":"MyCity",
"postalCode":"98000",
"state":"WA",
"street":"Contoso Way"
}
],
"phones":[
{
"number":"111-1111",
"type":"businessFax"
}
]
}
]
}
要求
次の例は要求を示しています。 この要求では、$count
が要求にあるため、ConsistencyLevel ヘッダーを eventual
に設定する必要があります。 ConsistencyLevel と $count
の使用の詳細については、「ディレクトリ オブジェクトに対する高度なクエリ機能 」を参照してください。
注: $count
および$search
のクエリパラメーターは、現在 Azure ADB2C テナントでは使用できません。
GET https://graph.microsoft.com/v1.0/contacts/$count
ConsistencyLevel: eventual
応答
次の例は応答を示しています。
HTTP/1.1 200 OK
Content-type: text/plain
893
要求
次の例は要求を示しています。 この要求では、$orderby
と $filter
の両方のクエリ パラメーターがあるため、ConsistencyLevel ヘッダーを eventual
および $count=true
クエリ文字列に設定することが必要です。 ConsistencyLevel と $count
の使用の詳細については、「ディレクトリ オブジェクトに対する高度なクエリ機能 」を参照してください。
注: $count
および$search
のクエリパラメーターは、現在 Azure ADB2C テナントでは使用できません。
GET https://graph.microsoft.com/v1.0/contacts?$filter=startswith(displayName,'A')&$count=true&$top=1&$orderby=displayName
ConsistencyLevel: eventual
// Code snippets are only available for the latest version. Current version is 5.x
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Contacts.GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Filter = "startswith(displayName,'A')";
requestConfiguration.QueryParameters.Count = true;
requestConfiguration.QueryParameters.Top = 1;
requestConfiguration.QueryParameters.Orderby = new string []{ "displayName" };
requestConfiguration.Headers.Add("ConsistencyLevel", "eventual");
});
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
// THE CLI IS IN PREVIEW. NON-PRODUCTION USE ONLY
mgc contacts list --top "1" --filter "startswith(displayName,'A')" --count "true" --orderby "displayName" --consistency-level "eventual"
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
import (
"context"
abstractions "github.com/microsoft/kiota-abstractions-go"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphcontacts "github.com/microsoftgraph/msgraph-sdk-go/contacts"
//other-imports
)
graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
headers := abstractions.NewRequestHeaders()
headers.Add("ConsistencyLevel", "eventual")
requestFilter := "startswith(displayName,'A')"
requestCount := true
requestTop := int32(1)
requestParameters := &graphcontacts.ContactsRequestBuilderGetQueryParameters{
Filter: &requestFilter,
Count: &requestCount,
Top: &requestTop,
Orderby: [] string {"displayName"},
}
configuration := &graphcontacts.ContactsRequestBuilderGetRequestConfiguration{
Headers: headers,
QueryParameters: requestParameters,
}
contacts, err := graphClient.Contacts().Get(context.Background(), configuration)
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
OrgContactCollectionResponse result = graphClient.contacts().get(requestConfiguration -> {
requestConfiguration.queryParameters.filter = "startswith(displayName,'A')";
requestConfiguration.queryParameters.count = true;
requestConfiguration.queryParameters.top = 1;
requestConfiguration.queryParameters.orderby = new String []{"displayName"};
requestConfiguration.headers.add("ConsistencyLevel", "eventual");
});
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
const options = {
authProvider,
};
const client = Client.init(options);
let contacts = await client.api('/contacts')
.header('ConsistencyLevel','eventual')
.filter('startswith(displayName,\'A\')')
.orderby('displayName')
.top(1)
.get();
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Contacts\ContactsRequestBuilderGetRequestConfiguration;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestConfiguration = new ContactsRequestBuilderGetRequestConfiguration();
$headers = [
'ConsistencyLevel' => 'eventual',
];
$requestConfiguration->headers = $headers;
$queryParameters = ContactsRequestBuilderGetRequestConfiguration::createQueryParameters();
$queryParameters->filter = "startswith(displayName,'A')";
$queryParameters->count = true;
$queryParameters->top = 1;
$queryParameters->orderby = ["displayName"];
$requestConfiguration->queryParameters = $queryParameters;
$result = $graphServiceClient->contacts()->get($requestConfiguration)->wait();
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
Import-Module Microsoft.Graph.Identity.DirectoryManagement
Get-MgContact -Filter "startswith(displayName,'A')" -CountVariable CountVar -Top 1 -Sort "displayName" -ConsistencyLevel eventual
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
from msgraph import GraphServiceClient
from msgraph.generated.contacts.contacts_request_builder import ContactsRequestBuilder
graph_client = GraphServiceClient(credentials, scopes)
query_params = ContactsRequestBuilder.ContactsRequestBuilderGetQueryParameters(
filter = "startswith(displayName,'A')",
count = True,
top = 1,
orderby = ["displayName"],
)
request_configuration = ContactsRequestBuilder.ContactsRequestBuilderGetRequestConfiguration(
query_parameters = query_params,
)
request_configuration.headers.add("ConsistencyLevel", "eventual")
result = await graph_client.contacts.get(request_configuration = request_configuration)
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
応答
次の例は応答を示しています。
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context":"https://graph.microsoft.com/v1.0/$metadata#contacts",
"@odata.count":1,
"value":[
{
"displayName":"Abigail Jackson",
"mail":"abigailJ@contoso.com",
"mailNickname":"abigailJ"
}
]
}
要求
次の例は要求を示しています。 この要求では、$search
と $count=true
のクエリ文字列が要求内にあるため、ConsistencyLevel ヘッダーを eventual
に設定する必要があります。 ConsistencyLevel と $count
の使用の詳細については、「ディレクトリ オブジェクトに対する高度なクエリ機能 」を参照してください。
注: $count
および$search
のクエリパラメーターは、現在 Azure ADB2C テナントでは使用できません。
GET https://graph.microsoft.com/v1.0/contacts?$search="displayName:wa"&$count=true
ConsistencyLevel: eventual
// Code snippets are only available for the latest version. Current version is 5.x
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Contacts.GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Search = "\"displayName:wa\"";
requestConfiguration.QueryParameters.Count = true;
requestConfiguration.Headers.Add("ConsistencyLevel", "eventual");
});
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
// THE CLI IS IN PREVIEW. NON-PRODUCTION USE ONLY
mgc contacts list --search ""displayName:wa"" --count "true" --consistency-level "eventual"
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
import (
"context"
abstractions "github.com/microsoft/kiota-abstractions-go"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphcontacts "github.com/microsoftgraph/msgraph-sdk-go/contacts"
//other-imports
)
graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
headers := abstractions.NewRequestHeaders()
headers.Add("ConsistencyLevel", "eventual")
requestSearch := "\"displayName:wa\""
requestCount := true
requestParameters := &graphcontacts.ContactsRequestBuilderGetQueryParameters{
Search: &requestSearch,
Count: &requestCount,
}
configuration := &graphcontacts.ContactsRequestBuilderGetRequestConfiguration{
Headers: headers,
QueryParameters: requestParameters,
}
contacts, err := graphClient.Contacts().Get(context.Background(), configuration)
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
OrgContactCollectionResponse result = graphClient.contacts().get(requestConfiguration -> {
requestConfiguration.queryParameters.search = "\"displayName:wa\"";
requestConfiguration.queryParameters.count = true;
requestConfiguration.headers.add("ConsistencyLevel", "eventual");
});
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
const options = {
authProvider,
};
const client = Client.init(options);
let contacts = await client.api('/contacts')
.header('ConsistencyLevel','eventual')
.search('displayName:wa')
.get();
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Contacts\ContactsRequestBuilderGetRequestConfiguration;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestConfiguration = new ContactsRequestBuilderGetRequestConfiguration();
$headers = [
'ConsistencyLevel' => 'eventual',
];
$requestConfiguration->headers = $headers;
$queryParameters = ContactsRequestBuilderGetRequestConfiguration::createQueryParameters();
$queryParameters->search = "\"displayName:wa\"";
$queryParameters->count = true;
$requestConfiguration->queryParameters = $queryParameters;
$result = $graphServiceClient->contacts()->get($requestConfiguration)->wait();
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
Import-Module Microsoft.Graph.Identity.DirectoryManagement
Get-MgContact -Search '"displayName:wa"' -CountVariable CountVar -ConsistencyLevel eventual
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
from msgraph import GraphServiceClient
from msgraph.generated.contacts.contacts_request_builder import ContactsRequestBuilder
graph_client = GraphServiceClient(credentials, scopes)
query_params = ContactsRequestBuilder.ContactsRequestBuilderGetQueryParameters(
search = "\"displayName:wa\"",
count = True,
)
request_configuration = ContactsRequestBuilder.ContactsRequestBuilderGetRequestConfiguration(
query_parameters = query_params,
)
request_configuration.headers.add("ConsistencyLevel", "eventual")
result = await graph_client.contacts.get(request_configuration = request_configuration)
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
応答
次の例は応答を示しています。
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context":"https://graph.microsoft.com/v1.0/$metadata#contacts",
"@odata.count":22,
"value":[
{
"displayName":"Nicole Wagner",
"mail":"nicolewa@contoso.com",
"mailNickname":"nicolewa"
}
]
}