Advertisement
Guest User

Untitled

a guest
Jun 8th, 2016
325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. try {
  2. $client = new SPOClient($url);
  3. $client->signIn($username,$password);
  4. echo 'You have authenticated successfullyn';
  5. }
  6. catch (Exception $e) {
  7. echo 'Connection failed: ', $e->getMessage(), "n";
  8. }
  9.  
  10. require_once 'SPOClient.php';
  11.  
  12. $username = 'username@tenant.onmicrosoft.com';
  13. $password = 'password';
  14. $url = "https://tenant.sharepoint.com/";
  15.  
  16. createTask($url,$username,$password);
  17.  
  18. function createTask($url,$username,$password){
  19. $client = new SPOClient($url);
  20. $client->signIn($username,$password);
  21. $listTitle = 'Tasks';
  22. $list = $client->getList($listTitle);
  23. $itemProperties = array('Title' => 'Order Approval', 'Body' => 'Order approval task');
  24. $item = $list->addItem($itemProperties);
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement