forked from jamesiarmes/php-ews
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding Contact creating and updating. Adding support for indexed URI'…
…s. Adding examples for contacts. Updating changelog
- Loading branch information
Showing
7 changed files
with
166 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
use jamesiarmes\PEWS\Contacts\ContactsAPI as API; | ||
|
||
$api = API::withUsernameAndPassword('server', 'username', 'password'); | ||
|
||
$api->createContacts(array ( | ||
'GivenName' => 'John', | ||
'Surname' => 'Smith', | ||
'EmailAddresses' => array( | ||
'Entry' => array('Key' => 'EmailAddress1', '_value' => '[email protected]') | ||
) | ||
)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
use jamesiarmes\PEWS\Contacts\ContactsAPI as API; | ||
|
||
$api = API::withUsernameAndPassword('server', 'username', 'password'); | ||
|
||
$contact = $api->getContacts(); | ||
|
||
$api->deleteItems($contact[0]->getItemId()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
use jamesiarmes\PEWS\Contacts\ContactsAPI as API; | ||
|
||
$api = API::withUsernameAndPassword('server', 'username', 'password'); | ||
|
||
$contact = $api->getContacts(); | ||
|
||
//EmailAddress is a bit different from most field updates. It's a what's known as an "Indexed Field URI", which means | ||
//that each email address has an "index". This is the "Key" that you used when creating this EmailAddress. So in order | ||
//to update it, we need to tell EWS what the key of the item we want to update is. For this, we use "EmailAddress:key". | ||
|
||
//However, we know that we want to update an email address, but the actual field we need to update is "EmailAddresses", | ||
//hence why instead of a simple $key => $value array, we have this multi-dimensional array. They value of | ||
//"EmailAddress:key" need to have the same structure as when we created the value | ||
$api->updateContactItem($contact[0]->getItemId(), array( | ||
'GivenName' => 'Jane', | ||
'EmailAddress:EmailAddress1' => array ( | ||
'EmailAddresses' => array ( | ||
'Entry' => array('Key' => 'EmailAddress1', '_value' => '[email protected]') | ||
) | ||
) | ||
)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters