Skip to content

Commit 6373014

Browse files
committed
Update samples with headers
1 parent 56e8030 commit 6373014

File tree

3 files changed

+37
-2
lines changed

3 files changed

+37
-2
lines changed

docs/general_samples.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ from msgraph.generated.users.item.messages.messages_request_builder import Messa
6363

6464
async def get_user_messages():
6565
request_config = MessagesRequestBuilder.MessagesRequestBuilderGetRequestConfiguration(
66-
headers={"prefer": "outlook.body-content-type=text"}
6766
)
67+
request_config.headers.add("prefer", "outlook.body-content-type=text")
6868

6969
messages = await (client.users.by_user_id('USER_ID')
7070
.messages

docs/users_samples.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,10 @@ async def find_user(user_name: str, client: GraphServiceClient) -> None:
7171
)
7272
request_configuration = (
7373
UsersRequestBuilder.UsersRequestBuilderGetRequestConfiguration(
74-
query_parameters=query_params, headers={"ConsistencyLevel": "eventual"}
74+
query_parameters=query_params,
7575
)
7676
)
77+
request_configuration.headers.add("ConsistencyLevel", "eventual")
7778

7879
response = await client.users.get(request_configuration=request_configuration)
7980
if response.value:

sample.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
2+
from azure.identity import AuthorizationCodeCredential
3+
from msgraph import GraphServiceClient
4+
from msgraph.generated.users.users_request_builder import UsersRequestBuilder
5+
from msgraph.generated.models
6+
from msgraph.generated.applications.item.remove_key.remove_key_post_request_body import RemoveKeyPostRequestBody
7+
8+
credentials = AuthorizationCodeCredential(
9+
'tenant_id',
10+
'client_id',
11+
'authorization_code',
12+
'redirect_uri'
13+
)
14+
scopes = []
15+
graph_client = GraphServiceClient(credentials=credentials, scopes=scopes)
16+
17+
async def aad_advanced_queries_get_users_accountenabled_python_V1():
18+
19+
20+
# THE PYTHON SDK IS IN PREVIEW. FOR NON-PRODUCTION USE ONLY
21+
22+
23+
24+
query_params = UsersRequestBuilder.UsersRequestBuilderGetQueryParameters(
25+
filter = "accountEnabled eq false",
26+
)
27+
28+
request_configuration = UsersRequestBuilder.UsersRequestBuilderGetRequestConfiguration(
29+
query_parameters = query_params,
30+
)
31+
32+
graph_client.external.connections.by_external_connection_id('').schema.patch()
33+
34+
result = await graph_client.users.get(request_configuration = request_configuration)

0 commit comments

Comments
 (0)