@@ -187,8 +187,7 @@ $client = (new ClientContext("https://{your-tenant-prefix}.sharepoint.com"))->wi
187187
188188$list = $client->getWeb()->getLists()->getByTitle("Tasks");
189189$itemProperties = array('Title' => 'Order Approval', 'Body' => 'Order approval task');
190- $item = $list->addItem($itemProperties);
191- $client->executeQuery();
190+ $item = $list->addItem($itemProperties)->executeQuery();
192191print "Task {$item->getProperty('Title')} has been created.\r\n";
193192```
194193
@@ -202,8 +201,7 @@ $client = (new ClientContext("https://{your-tenant-prefix}.sharepoint.com"))->wi
202201
203202$list = $client->getWeb()->getLists()->getByTitle("Tasks");
204203$listItem = $list->getItemById("{item-id-to-delete}");
205- $listItem->deleteObject();
206- $client->executeQuery();
204+ $listItem->deleteObject()->executeQuery();
207205```
208206
209207Example 4. How to update SharePoint list item:
@@ -217,8 +215,7 @@ $client = (new ClientContext("https://{your-tenant-prefix}.sharepoint.com"))->wi
217215$list = $client->getWeb()->getLists()->getByTitle("Tasks");
218216$listItem = $list->getItemById("{item-id-to-update}");
219217$listItem->setProperty('PercentComplete',1);
220- $listItem->update();
221- $client->executeQuery();
218+ $listItem->update()->executeQuery();
222219```
223220
224221
@@ -311,9 +308,7 @@ function acquireToken()
311308}
312309
313310$client = new GraphServiceClient("acquireToken");
314- $drive = $client->getMe()->getDrive();
315- $client->load($drive);
316- $client->executeQuery();
311+ $drive = $client->getMe()->getDrive()->get()->executeQuery();
317312print $drive->getWebUrl();
318313
319314```
0 commit comments