Example #1
1
function connectSPO($url, $username, $password)
{
    try {
        $client = new SPOClient($url);
        $client->signIn($username, $password);
        echo 'You have been authenticated successfully\\n';
    } catch (Exception $e) {
        echo 'Authentication failed: ', $e->getMessage(), "\n";
    }
}
Example #2
0
/**
 * Update list item opeation example
 * @param mixed $url 
 * @param mixed $username 
 * @param mixed $password 
 */
function updateTask($url, $username, $password)
{
    $client = new SPOClient($url);
    $client->signIn($username, $password);
    $listTitle = 'Tasks';
    $list = $client->getList($listTitle);
    $itemProperties = array('PercentComplete' => 1);
    $list->updateItem(2, $itemProperties);
}
Example #3
0
function generateContacts($url, $username, $password)
{
    $client = new SPOClient($url);
    $client->signIn($username, $password);
    $contactsCount = 120;
    for ($i = 0; $i < $contactsCount; $i++) {
        $contactEntry = createContactEntry();
        $item = addContact($client, $contactEntry);
        print "Contact '{$item->Title}' has been created succesfully.\r\n";
    }
}