@@ -23,7 +23,6 @@ private static function simpleBatch(GraphServiceClient $graphClient): void {
2323 // Use the request builder to generate a GET
2424 // request to /me
2525 $ userRequest = $ graphClient ->me ()->toGetRequestInformation ();
26- $ userRequest ->setUri (BatchRequests::fixUri ($ userRequest ));
2726
2827 $ timeZone = new \DateTimeZone ('America/New_York ' );
2928 $ today = new \DateTimeImmutable ('today midnight ' , $ timeZone );
@@ -32,11 +31,10 @@ private static function simpleBatch(GraphServiceClient $graphClient): void {
3231 // Use the request builder to generate a GET
3332 // request to /me/calendarView?startDateTime="start"&endDateTime="end"
3433 $ query = new CalendarViewRequestBuilderGetQueryParameters (
35- startDateTime: $ today ->format (\DateTimeInterface:: ISO8601 ),
36- endDateTime: $ tomorrow ->format (\DateTimeInterface:: ISO8601 ));
34+ startDateTime: $ today ->format (\DateTime:: ATOM ),
35+ endDateTime: $ tomorrow ->format (\DateTime:: ATOM ));
3736 $ config = new CalendarViewRequestBuilderGetRequestConfiguration (queryParameters: $ query );
3837 $ eventsRequest = $ graphClient ->me ()->calendarView ()->toGetRequestInformation ($ config );
39- $ eventsRequest ->setUri (BatchRequests::fixUri ($ eventsRequest ));
4038
4139 // Build the batch
4240 $ userRequestItem = new BatchRequestItem ($ userRequest );
@@ -78,7 +76,6 @@ private static function dependentBatch(GraphServiceClient $graphClient): void {
7876 // Use the request builder to generate a
7977 // POST request to /me/events
8078 $ addEventRequest = $ graphClient ->me ()->events ()->toPostRequestInformation ($ newEvent );
81- $ addEventRequest ->setUri (BatchRequests::fixUri ($ addEventRequest ));
8279
8380 $ timeZone = new \DateTimeZone ('America/New_York ' );
8481 $ today = new \DateTimeImmutable ('today midnight ' , $ timeZone );
@@ -87,11 +84,10 @@ private static function dependentBatch(GraphServiceClient $graphClient): void {
8784 // Use the request builder to generate a GET
8885 // request to /me/calendarView?startDateTime="start"&endDateTime="end"
8986 $ query = new CalendarViewRequestBuilderGetQueryParameters (
90- startDateTime: $ today ->format (\DateTimeInterface:: ISO8601 ),
91- endDateTime: $ tomorrow ->format (\DateTimeInterface:: ISO8601 ));
87+ startDateTime: $ today ->format (\DateTime:: ATOM ),
88+ endDateTime: $ tomorrow ->format (\DateTime:: ATOM ));
9289 $ config = new CalendarViewRequestBuilderGetRequestConfiguration (queryParameters: $ query );
9390 $ eventsRequest = $ graphClient ->me ()->calendarView ()->toGetRequestInformation ($ config );
94- $ eventsRequest ->setUri (BatchRequests::fixUri ($ eventsRequest ));
9591
9692 // Build the batch
9793 // Force the requests to execute in order, so that the request for
@@ -118,12 +114,6 @@ private static function dependentBatch(GraphServiceClient $graphClient): void {
118114 $ events = $ batchResponse ->getResponseBody ($ eventsRequestItem ->getId (), Models \EventCollectionResponse::class);
119115 print ('You have ' .count ($ events ->getValue ()).' events on your calendar today ' .PHP_EOL );
120116 // </DependentBatchSnippet>
121- }
122-
123- // Temporary workaround for
124- // https://github.com/microsoftgraph/msgraph-sdk-php-core/issues/126
125- private static function fixUri (RequestInformation $ request ): string {
126- return str_replace ('/users/me-token-to-replace ' , '/me ' , $ request ->getUri ());
127117 }
128118}
129119?>
0 commit comments