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"; } }
/** * 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); }
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"; } }