4
votes

I want to do few things with sharepoint online 365 and php.

I have a php form with three textbox and when click on submit button by entering data, it should save to custom list which is in office online 365 sharepoint.

is it possible to do like this with office online 365 sharepoint and php compactiblilty

With asp.net we can add dll of microsoft.client.runtime do this dll supports in php also.

Please have a look over this link: Is this helpful?

https://gist.github.com/lstak/2404924#file-main-js

Any help would be appreciated thanks.

3

3 Answers

2
votes

There are a few approaches to running PHP and SharePoint Online.

The first would be to use a Provider Hosted App in SharePoint where PHP is the provider hosted aspect of the app. You can find out more about Provider Hosted apps on MSDN and there was a great session at the SharePoint Conference that covered this http://channel9.msdn.com/Events/SharePoint-Conference/2012/SPC030

The other is to leverage the new Office 365 APIs and Azure AD authentication stack. Right now our focus on these APIs is around Visual Studio project types as per our announcement here. http://blogs.office.com/2014/05/12/net-and-javascript-libraries-for-office-365-apis/

We are looking at building out some PHP samples in the future once we get code samples out for the key Visual Studio scenarios around Office 365 APIs.

Both of these approaches do not require you to capture users credentials and call CSOM and REST as everything is handled via OAuth tokens.

1
votes

phpSPO - SharePoint client for PHP The library provides a SharePoint client for PHP applications. This allows you to performs CRUD operations on SharePoint list data, using an REST/OData based API for SharePoint Online.

The current version supports SharePoint Online using claims based authentication.

Examples

<?php

require_once 'SPOClient.php';

$username = '[email protected]';
$password = 'password';
$url = "https://tenant.sharepoint.com/";

$client = new SPOClient($url);
$client->signIn($username,$password);

//Get Tasks list
$listTitle = 'Tasks';
$list = $client->getList($listTitle);

//Create a Task item
$itemProperties = array('Title' => 'Order Approval', 'Body' => 'Order approval task');
$taskItem = $list->addItem($itemProperties);
print "Task '{$taskItem->Title}' has been created succesfully.\r\n";

$itemId = $taskItem->Id;
//Update a Task item
$itemProperties = array('PercentComplete' => 1);
$list->updateItem($itemId,$itemProperties);

//Delete a Task item
$list->deleteItem($itemId);

?>

References

SharePoint Online client for PHP

1
votes

As Vadim stated, phpSPO works, but currently does not support AD SharePoint Implementeations. If you use your organizational account to access SharePoint online you'll get "Authentication failed: Direct login to WLID is not allowed for this federated namespace" message when you try to authenticate.