Skip to content

Commit e730592

Browse files
committed
Documentation updated
1 parent 6cd2f1c commit e730592

File tree

2 files changed

+25
-9
lines changed

2 files changed

+25
-9
lines changed

README-Dev.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Installing dependencies
2+
3+
Enable the following extensions:
4+
- [PHP cURL](https://www.php.net/manual/en/book.curl.php)
5+
- [DOM](https://www.php.net/manual/en/book.dom.php)
6+
- [Multibyte String](https://www.php.net/manual/en/book.mbstring.php)
7+
8+
On Linux (Ubuntu):
9+
10+
```
11+
apt-get install php-curl
12+
apt-get install php-dom
13+
apt-get install php-mbstring
14+
```
15+
16+
# Running tests
17+
18+
19+
```
20+
vendor/bin/phpunit --bootstrap tests/bootstrap.php --no-configuration tests/sharepoint
21+
```

README.md

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -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();
192191
print "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

209207
Example 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();
317312
print $drive->getWebUrl();
318313

319314
```

0 commit comments

Comments
 (0)