Skip to content

Commit

Permalink
Update samples with headers
Browse files Browse the repository at this point in the history
  • Loading branch information
samwelkanda committed Oct 27, 2023
1 parent 56e8030 commit 6373014
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/general_samples.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ from msgraph.generated.users.item.messages.messages_request_builder import Messa

async def get_user_messages():
request_config = MessagesRequestBuilder.MessagesRequestBuilderGetRequestConfiguration(
headers={"prefer": "outlook.body-content-type=text"}
)
request_config.headers.add("prefer", "outlook.body-content-type=text")

messages = await (client.users.by_user_id('USER_ID')
.messages
Expand Down
3 changes: 2 additions & 1 deletion docs/users_samples.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,10 @@ async def find_user(user_name: str, client: GraphServiceClient) -> None:
)
request_configuration = (
UsersRequestBuilder.UsersRequestBuilderGetRequestConfiguration(
query_parameters=query_params, headers={"ConsistencyLevel": "eventual"}
query_parameters=query_params,
)
)
request_configuration.headers.add("ConsistencyLevel", "eventual")

response = await client.users.get(request_configuration=request_configuration)
if response.value:
Expand Down
34 changes: 34 additions & 0 deletions sample.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

from azure.identity import AuthorizationCodeCredential
from msgraph import GraphServiceClient
from msgraph.generated.users.users_request_builder import UsersRequestBuilder
from msgraph.generated.models
from msgraph.generated.applications.item.remove_key.remove_key_post_request_body import RemoveKeyPostRequestBody

credentials = AuthorizationCodeCredential(
'tenant_id',
'client_id',
'authorization_code',
'redirect_uri'
)
scopes = []
graph_client = GraphServiceClient(credentials=credentials, scopes=scopes)

async def aad_advanced_queries_get_users_accountenabled_python_V1():


# THE PYTHON SDK IS IN PREVIEW. FOR NON-PRODUCTION USE ONLY



query_params = UsersRequestBuilder.UsersRequestBuilderGetQueryParameters(
filter = "accountEnabled eq false",
)

request_configuration = UsersRequestBuilder.UsersRequestBuilderGetRequestConfiguration(
query_parameters = query_params,
)

graph_client.external.connections.by_external_connection_id('').schema.patch()

result = await graph_client.users.get(request_configuration = request_configuration)

0 comments on commit 6373014

Please sign in to comment.