We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Linking to my StackOverflow question:
https://stackoverflow.com/questions/79070227/calendarviewrequestbuilder-msgraph-python-sdk-query-parameter-for-start-da
returning events in the specified date range
# Create GraphServiceClient graph_client = GraphServiceClient(credential, scopes) # Define date range for fetching events start_date = datetime.now(pytz.utc) end_date = start_date + timedelta(days=365) # Format dates correctly for the Graph API in ISO 8601 format start_date_str = start_date.strftime("%Y-%m-%dT%H:%M:%S%z") end_date_str = end_date.strftime("%Y-%m-%dT%H:%M:%S%z") # Insert colon in timezone offset start_date_str = start_date_str[:-2] + ":" + start_date_str[-2:] end_date_str = end_date_str[:-2] + ":" + end_date_str[-2:] print(f"Fetching events from {start_date_str} to {end_date_str}") # Set up the request configuration with query parameters as a dictionary query_params = CalendarViewRequestBuilder.CalendarViewRequestBuilderGetQueryParameters( start_date_time=start_date_str, end_date_time=end_date_str, select=['subject', 'start', 'end'], top=100, orderby=['start/dateTime ASC'], #filter="contains(subject, 'from HR Works')" ) headers = HeadersCollection() headers.add("Prefer", 'outlook.timezone="Europe/Berlin"') request_configuration = RequestConfiguration( query_parameters=query_params, headers=headers ) all_events = [] try: # Initial request events_page = await graph_client.users.by_user_id(user_id).calendars.by_calendar_id(calendar_id).events.get(request_configuration=request_configuration) ...
1.9.0
No response
Usage of the API via Graph Explorer works.
</details> ### Configuration _No response_ ### Other information _No response_
The text was updated successfully, but these errors were encountered:
Hello @grumpyp thanks for using the SDK and for raising this.
Yes, start date and end_date are not valid for the CalendarViewRequestBuilder, https://github.com/microsoftgraph/msgraph-sdk-python/blob/main/msgraph/generated/solutions/booking_businesses/item/calendar_view/calendar_view_request_builder.py
The appropriate keys for your use case would be start and end
start
end
Your code with the adjustment below works perfectly for me:
query_params = CalendarViewRequestBuilder.CalendarViewRequestBuilderGetQueryParameters( start=start_date_str, end=end_date_str, select=['subject', 'start', 'end'], top=100, orderby=['start/dateTime ASC'], #filter="contains(subject, 'from HR Works')" )
Sorry, something went wrong.
grumpyp
No branches or pull requests
Describe the bug
Linking to my StackOverflow question:
https://stackoverflow.com/questions/79070227/calendarviewrequestbuilder-msgraph-python-sdk-query-parameter-for-start-da
Expected behavior
returning events in the specified date range
How to reproduce
SDK Version
1.9.0
Latest version known to work for scenario above?
No response
Known Workarounds
Usage of the API via Graph Explorer works.
Debug output
Click to expand log
```The text was updated successfully, but these errors were encountered: