PHP SharePoint Integration

General Tech Bugs & Fixes 2 years ago

0 2 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating

Posted on 16 Aug 2022, this text provides information on Bugs & Fixes related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (2)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years ago

 

I am new to SharePoint . I'm trying to access SharePoint list via PHP. I am able to connect to SharePoint which means my app is authenticating but not able access list data.

ERROR THROWN IS:

List does not exist. The page you selected contains a list that does not exist. It may have been deleted by another user

php

//Requires the NuSOAP library
require_once('lib/nusoap.php');

$username = 'my_user_name';
$password = 'my_password';
$rowLimit = '150';

/* A string that contains either the display name or the GUID for the list.
 * It is recommended that you use the GUID, which must be between curly
 * braces ({}).
 */
$listName = "Custom App_3";

/* Local path to the Lists.asmx WSDL file (localhost). You must first download
 * it manually from your SharePoint site (which should be available at
 * yoursharepointsite.com/subsite/_vti_bin/Lists.asmx?WSDL)
 */
$wsdl = "http://localhost/share_point_php/Soap/SharePointAPI.wsdl";

//Basic authentication. Using UTF-8 to allow special characters.
$client = new nusoap_client($wsdl, true);

 $client->setCredentials($username,$password);
$client->soap_defencoding='UTF-8';

//XML for the request. Add extra fields as necessary
$xml ='

'.$listName.'
'.$rowLimit.'

';

//Invoke the Web Service
$result = $client->call('GetListItems', $xml);
 var_dump($result);
//Error check
if(isset($fault)) {
  echo("[![

][1]][1]Error

"
. $fault); } //Extracting and preparing the Web Service response for display $responseContent = utf8_decode(htmlspecialchars(substr($client->response,strpos($client->response, "<"),strlen($client->response)-1))); //Displaying the request and the response, broken down by header and XML content echo "

Request

" . utf8_decode(htmlspecialchars($client->request, ENT_QUOTES)) . "
"
; echo "

Response header

" . utf8_decode(htmlspecialchars(substr($client->response,0,strpos($client->response, "<")))) . "
"
; echo "

Response content

".$responseContent."
"
; //Uncomment for debugging info: //echo("

Debug

" . htmlspecialchars($client->debug_str, ENT_QUOTES) . "
");
unset($client); ?>
profilepic.png
manpreet 2 years ago

Try this api: https://github.com/thybag/PHP-SharePoint-Lists-API

I have tried and it works perfectly. you can also find how to's of the api on same link.

use Thybag\SharePointAPI; $sp = new SharePointAPI('<user@domain.onmicrosoft.com>','',','SPONLINE'); //SPONLINE if your point is online else add true instead $data = $sp->read('Documents'); var_dump($data);

This will return you the array of all lists stored on sharepoint. Then based on your need you can get the file name by calling array from the above array list.


0 views   0 shares

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.