Coder Social home page Coder Social logo

php-sharepoint-lists-api's Introduction

Hello world

php-sharepoint-lists-api's People

Contributors

andrew-kzoo avatar binaryzeph avatar burgov avatar cdcastro avatar csmithmedia avatar cweiske avatar dnna avatar fernandosantini avatar jackfruh avatar jna-unikent avatar kasperg avatar kcjones avatar luffy-xiao avatar mgroat avatar quix0r avatar svenluijten avatar thybag avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

php-sharepoint-lists-api's Issues

Unauthorized

Hi,

I've entered my Sharepoint username and password and received the following error (I've changed my actual credentials to 'username' and 'password'):

Fault code: HTTP
Fault string: Unauthorized
Warning: DOMDocument::loadXML() [function.DOMDocument-loadXML]: Empty string supplied as input in /srv/www/htdocs/wwwkc/includes/sharepoint/sharepointAPI.php on line 252
sharepointAPI Object ( [spUser:private] => username [spPass:private] => password [wsdl:private] => Lists.wsdl [MAX_ROWS:private] => 10000 )

I've managed to connect using SOAP/cURL in the past, so my credentials are correct.
Any ideas where I'm going wrong?

Error Forbidden line 915

Error (HTTP) Forbidden,more= in C:\wamp\www\SP\SharePointAPI.php on line 915

I am trying to connect with PHP into Sharepoint.

When I run php file I get error on line 915 as seen above.

Not sure what is going on. I enter correct password and name but I find out it is not taking password and username at all. I can change it to whatever and still getting same error. When I comment line 915 I will get blank page with no error.

read('TblCustomer')); echo 'Hello World'; ?>

I will not echo second Hello World and PHP will die because It throw fatal error on line 915 but when I comment the line 915 I will echo another Hello World.

My case is that when I type url I am requested to enter name and pw so is there any change this a issue of wrong user permission?? but user I am connecting to SP has full control. Any ideas?

Versioning

Hello -

I am happy to look into this, but before I put forth effort I wanted to check to see if you have experienced this... I am needing to try to use the API to read an older version of an item on a sharepoint list.

Example: Someone creates a record (first version), then they updated it, we now have a second version in versioning history. I need to compare the two in PHP.

Do you know if this is possible?

Thanks,

Tim

Need ability to pass query options through QueryObjectService

I am implementing a query to a SP 2013 calendar and in order to get the recurring events I need to pass the query option "TRUE". In order to do this I would like the "get" function in QueryObjectService to accept an argument for options and pass that to the api read function, like this:

public function get ($options = NULL) {

    // String = view, array = specific fields
    $view = (sizeof($this->fields) === 0) ? $this->view : $this->fields;

    return $this->api->read($this->list_name, $this->limit, $this, $view, NULL, $options);
}

I'm using the SharePointAPI instead of ListService so I can pass in some raw CAML.

Wrong version exception

I have updated to the most recent SharePointAPI.php, and I am getting the following error:

PHP Fatal error: Uncaught exception 'Exception' with message 'Error (VersionMismatch) Wrong Version,more=' in /usr/local/bin/SharePointAPI.php:835
Stack trace:
#0 /usr/local/bin/SharePointAPI.php(461): SharePointAPI->onError(Object(SoapFault))
#1 /usr/local/bin/upload_providers.php(109): SharePointAPI->read('{387DF9C7-7389-...', NULL, Object(SPQueryObj))
#2 {main}

thrown in /usr/local/bin/SharePointAPI.php on line 835

I am using SharePoint 2010

Or and Other Qualifiers?

Has there been any thought put into a function to pull more than "And", and "Eq"? I worked on a snippet to allow the other comparisons, but have not sorted out how to easily implement "" into the where clause.

Before I put much more work into it, I just wondered if you had already.

Thanks,

Tim

Cannot use using() in combination with query()

// Setup Options
        if ($query instanceof Service\QueryObjectService) {
            $xml_query = $query->getCAML();
        } else {
            if (!is_null($view)) {
                $xml_options .= '<viewName>' . $view . '</viewName>';
            }
            if (!is_null($query)) {
                $xml_query .= $this->whereXML($query); // Build Query
            }
            if (!is_null($sort)) {
                $xml_query .= $this->sortXML($sort);
            }
        }

This is causing read() to ignore $view.

Support SharePoint Online

Does this list Api supports also SharePoint Online=

Im developing an interface to interact with an Open source program and SharePoint Online (Office 365). Im eventually getting an 10054 error, it seems like i have connection but later on got disconnected. Got this error:

Fatal error: Maximum execution time of 30 seconds exceeded in C:\xampp\htdocs\index.php on line 122

I will appreciate your collaboration!

Thanks in advance, Alex Sanchez

Blank page when running

Hi,
I download code enter my password and username, download list and change it in code but when running the code on localhost only white page is displayed any idea where is the problem?
Regards

getItemVersions mismatches versions

I didn't realize that SharePoint doesn't save a version of each and every field/column, regardless of if it had a value, or was changed.

Because of this, I was thought that each getFieldVersions() always returned the same amount of array elements, regardless of the field that was given.

Since there could be different amounts of array elements, getItemVersions() isn't associating the versions correctly.

failed to load external entity

I am happy to find your work, I am however having a bit of trouble using it.

the blog I'm trying to access requires http authorization, so when I initiate a new object I have the use SoapClientAuth variable set to TRUE as required.

the relevant code is:
{code}
class MySharePointAPI extends SharePointAPI {
public function __construct ($spUsername, $spPassword, $spWsdl, $useNtlm = FALSE) {
// Set 1.1 version
$this->soap_version = SOAP_1_1;

    // ntlmaps
    $this->proxyHost = 'IPADDRESS';
    $this->proxyPort = 80;

    parent::__construct($spUsername, $spPassword, $spWsdl, $useNtlm);
}

}

// authenticate with NTLM (uses SoapClientAuth extends SoapClient class)
$sp = new MySharePointAPI($sharePoint['login'],$sharePoint['password'],$sharePoint['url'], TRUE);
{code}

the message I get is:

SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://IPADDRESS/blog/_vti_bin/lists.asmx' : failed to load external entity "http://IPADDRESS/blog/_vti_bin/lists.asmx"

I can use POSTER in firefox and get a valid response for say getting a listName, after I authenticate username:password in browser.

Fatal error if URL has port number

If WSDL url has port number like

http://whateverserver:1234/_vti....

Script gives error below

Fatal error: Uncaught exception 'Exception' with message 'Unable to locate WSDL file. faultcode=0,faultstring=SOAP-ERROR: Parsing WSDL: Couldn't load from

Trying to replicate this SOAP query

I am trying to reproduce this query using your API..any assistance would be helpful:

<listName>{######}</listName>
<viewName>{#######}</viewName>
<query><Query>
<Where>
<And><Eq><FieldRef Name="Blog_x0020_Category" /><Value Type="Choice">Grants Management</Value></Eq>
<And>
<And><Eq><FieldRef ame="_ModerationStatus" /><Value Type="ModStat">Approved</Value></Eq>
<Eq><FieldRef Name="Display_x0020_on_x0020_website_x" /><Value Type="Boolean">1</Value></Eq></And>
<Or><Leq><FieldRef Name="Public_x0020_website_x0020_relea" /><Value IncludeTimeValue="TRUE" Type="DateTime">2013-06-06T09:51Z</Value></Leq>
<IsNull><FieldRef Name="Public_x0020_website_x0020_relea" /></IsNull>
</Or>
</And>
</And>
 </Where>
 <OrderBy><FieldRef Name="PublishedDate" Ascending="False" /></OrderBy>
</Query></query>
<rowLimit>500 </rowLimit>

wrong Namespace of thrown Exception in StreamWrapperHttpAuth.php

Hi,

while testing around with the Sharepoint API on Sharepoint 2010 with NTLM/HTTP Authentication the following code error was thrown:

Fatal error: Uncaught exception 'Exception' with message 'Unable to locate WSDL file. faultcode=0,faultstring=Class 'Thybag\Auth\Exception' not found' in /opt/noc_scripts/project/share2mailng/vendor/thybag/php-sharepoint-lists-api/src/Thybag/SharePointAPI.php:183
Stack trace:
#0 /opt/noc_scripts/project/share2mailng/share2mailng.php(27): Thybag\SharePointAPI->__construct('...', '..., '...', 'NTLM')
#1 {main}

thrown in /opt/noc_scripts/project/share2mailng/vendor/thybag/php-sharepoint-lists-api/src/Thybag/SharePointAPI.php on line 183

Please notice the faultstring=Class 'Thybag\Auth\Exception' not found'. From what I see this is caused by the missing '' before 'Exception' so php will search the class Exception in the Namespace of the class StreamWrapperHttpAuth.php

Adding a '' before Exception on the lines 112, 121, 126, 129 solves the problem.

Greetings,
Michael

Open List Item

Hi, thanks for the API. Working great so far.

One question, is there an 'open list item' method that I can pass an item ID to and have it open the item for me? Maybe its already there and I've missed it.

Specifically I'm authorizing to a sharepoint online site, querying a list of documents and returning a subset. I'd like to the provide a link to open a document in the returned list.

Thanks!

CURLOPT_CERTINFO should be long not string

Having a problem with possibly the server config on a remote DEV server. Although the code works on my local DEV environment (macports LAMP stack), it gives this error on remote DEV server.

Warning: curl_setopt() expects parameter 2 to be long, string given in SoapClientAuth->__doRequest() (line 110 of /var/www/html/sites/all/modules/custom/sharepoint/helper/SoapClientAuth.php).

Notice: Use of undefined constant CURLOPT_CERTINFO - assumed 'CURLOPT_CERTINFO' in SoapClientAuth->__doRequest() (line 110 of/var/www/html/sites/all/modules/custom/sharepoint/helper/SoapClientAuth.php).

CURLOPT_CERTINFO should be long not string
CURLOPT_CERTINFO = 172 on my local.

Curl Error

I can get curl to work from the CLI-
curl --ntlm --user domainusername:password http://hostname --verbose

That has no issues seeing the server, logging in and getting a redirect to the primary sites page.

That said, I'm getting an error in the httpd error_log-

PHP Fatal error: Uncaught exception 'Exception' with message 'Error (CURL error: couldn't connect to host) 7,more=' in /usr/share/php/lib/SharePointAPI.php:861\nStack trace:\n#0 /usr/share/php/lib/SharePointAPI.php(477): SharePointAPI->onError(Object(SoapFault))\n#1 /var/www/html/report/sp_test2.php(34): SharePointAPI->read('{0E0F4BF8-8E5B-...')\n#2 {main}\n thrown in /usr/share/php/lib/SharePointAPI.php on line 861,

Here's my script that's calling SharePointAPI.php-

"; echo "

"; $username = domainusername; $password = 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 = "{0E0F4BF8-8E5B-46C6-AC03-37D569216C8A}"; /\* 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/report/Lists.wsdl"; // use ntlm authen $useNtlm=TRUE; echo "Attempting to create connection
"; $client = new SharePointAPI($username,$password,$wsdl,$useNtlm); echo "attempting to read the list
"; $data = $client->read($listName); echo $data; echo "attempting to get all lists:
"; $data = $client->getLists(); echo $data; ?>

I'm only guessing, but I think it's throwing the exception when I try to create $client.

Any thoughts or suggestions are appreciated. System is Cent6.3 using RHEL repo only.

can't use api commands - error

this is my code:

include "Thybag\SharePointAPI.php";
include "Thybag\Auth\SharePointOnlineAuth.php";
include "Thybag\Auth\SoapClientAuth.php";
include "Thybag\Auth\StreamWrapperHttpAuth.php";
include "Thybag\Service\ListService.php";
include "Thybag\Service\QueryObjectService.php";

use Thybag\SharePointAPI;
use Thybag\Service\ListService;
use Thybag\Service\QueryObjectService;

$sp = new SharePointAPI('&&', '&&', 'http://localhost/Lists.asmx.xml', TRUE);

$sp->getLists();

trying to execute this, the browser throws the following:

Fatal error: Uncaught exception 'Exception' with message 'Error' in C:\xampp\htdocs\Thybag\Auth\SoapClientAuth.php:130 Stack trace: #0 [internal function]: Thybag\Auth\SoapClientAuth->__doRequest('<?xml version="...', 'http://share.mi...', 'http://schemas....', 1, 0) #1 C:\xampp\htdocs\Thybag\SharePointAPI.php(276): SoapClient->__call('GetListCollecti...', Array) #2 C:\xampp\htdocs\Thybag\SharePointAPI.php(276): Thybag\Auth\SoapClientAuth->GetListCollection() #3 C:\xampp\htdocs\listen.php(19): Thybag\SharePointAPI->getLists() #4 {main} thrown in C:\xampp\htdocs\Thybag\Auth\SoapClientAuth.php on line 130

logging in works fine, but when i actually want to use commands like getLists i get this error. what can i do?

Missing Fields

Love it, however when I do a get() or query() not all the fields will be returned. I know they exist and they can be interacted with because I am able to do an update or insert action. At first I thought it was only field types with multiple lines of text (that was the first type I noticed) but there does not appear to be any pattern associated with the field type (the multiple lines of text's are all set to plain text just in case you were curious). I have quite a few fields that I have defined (~70+).

Support viewFields rather than requiring a predefined view

Please add the ability to use viewFields as per http://msdn.microsoft.com/en-us/library/office/websvclists.lists.getlistitems.aspx instead of requiring a view to be created.

My users aren't sophisticated, so I would prefer not to have another view in the list for every different case.

$sp->query('List')->fields(array('Field1', 'Field2', 'Field3'))->get();
$sp->query('List')->columns(array('Column1', 'Column2', 'Column3'))->get();

I would probably do both fields and columns as SP calls them columns in the GUI, but they are fields in the backend.

Character encoding problems

Our script, API and Sharepoint online are using UTF-8 encoding but a Czech special characters are not transferred to Sharepoint via API write function. Does someone have any idea how to solve that?

Thanks a lot

NTLM support

Any idea if you'll support NTLM authentication?

Delete Attachments

I needed to delete attachments so I made the following mod:

/**
 * deleteAttachment
 * Remove an attachment from a SharePoint list item
 *
 * @param $list_name Name of list
 * @param $list_item_id ID of record item is attached to
 * @param $url
 */
public function deleteAttachment ($list_name, $list_item_id, $url) {
    // Wrap in CAML
    $CAML = '
    <DeleteAttachment xmlns="http://schemas.microsoft.com/sharepoint/soap/">
        <listName>' . $list_name . '</listName>
        <listItemID>' . $list_item_id . '</listItemID>
        <url>' . $url . '</url>
    </DeleteAttachment>';

    $xmlvar = new \SoapVar($CAML, XSD_ANYXML);

    // Attempt to run operation
    try {
        $this->soapClient->DeleteAttachment($xmlvar);
    } catch (\SoapFault $fault) {
        $this->onError($fault);
    }

    // Return true on success
    return true;
}

Perhaps you could add it to the next build.

MultiChoice field type documentation?

Love the library. Any chance of getting some documentation on how $sp->write works with Choice->Checkbox ("MultiChoice" type) fields (maybe just a one-line example)? I'm tinkering with that now and noticed there wasn't much helpful from Microsoft, either; let me know if that's much more involved than I realize!

How to add Hyperlink text

What is the command to add hyperlink text? Whenever, I tried to add hyperlinks, it is throwing "One or more field types are not installed properly. Go to the list settings page to delete these fields." I tried by giving comma between url and text as url, text but it is throwing the above error. I tried reconstructing the caml but in vain. Please let me the know the solution.

addAttachment issue

For attachment in Sharepoint online i am getting this "Error:Fatal error: Uncaught exception 'Exception' with message 'Error (soap:Receiver) Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.,more=".but I can able to get List items and all?

Wildcard or LIKE queries

Hi, wondering if it's possible to write a wildcard search into the queries?

e.g. I need to grab all list items created in 2015. Something like this:

$year = 2015 ;
$sp->query('List')->where('Created', '=', $year . "%")->get();

Example format of Created field is: "2015-08-19 11:00:00".

CopyIntoItems.aspx

I use the api with great success (NTLM auth), thx for that. But now I wanted to use the CopyIntoItems WS to upload files into a SP Library and tried it as follows:

$sourceurl = 'http://null';

$params = '
    <CopyIntoItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">
        <SourceUrl>'.$sourceurl.'</SourceUrl>
        <DestinationUrls>' . $destinationURLs . '</DestinationUrls>
        <Stream>' . $stream . '</Stream>
    </CopyIntoItems>
        ';

$xmlvar = new \SoapVar($params, XSD_ANYXML);
// Attempt to run operation
try {
    $result = $this->soapClient->CopyIntoItems($xmlvar)->CopyIntoItemsResponse->CopyIntoItemsResult;
} catch (\SoapFault $fault) {
   $this->onError($fault);
}

I get no SoapError, but nothing happens, the result is NULL, could anyone help? THX in advance

Regarding the retrieval of list

getLists()); ?>

Hi I have made a seperate file which is as shown using library.I am not able to set up connection also.
I am facing this error-It may be down for maintenance or configured incorrectly.Waiting for response

Unable to unregister protocol https://

I found an annoying number of php warnings in my logs using the SoapClientAuth.php file:

Warning: stream_wrapper_unregister() [function.stream-wrapper-unregister]: Unable to unregister protocol https:// in SoapClientAuth->SoapClientAuth() (line 49 of /Users/mark.susol/Sites/drupal_mktg/webapp/sites/all/modules/custom/sharepoint/helper/SoapClientAuth.php).

..and found it necessary to modify the code to check for the https wrapper before using the unregister command. Not sure if this is an exact solution, but worth mentioning.

    function SoapClientAuth($wsdl, $options = NULL) {
        // TODO MODIFICATION
        $wrappers = stream_get_wrappers();
        if ( in_array("https", $wrappers) ) {
            stream_wrapper_unregister('https');
            stream_wrapper_register('https', 'streamWrapperHttpAuth');
        }
        stream_wrapper_unregister('http');
        stream_wrapper_register('http', 'streamWrapperHttpAuth');

        if ($options) {
            $this->Username = $options['login'];
            streamWrapperHttpAuth::$Username = $this->Username;
            $this->Password = $options['password'];
            streamWrapperHttpAuth::$Password = $this->Password;
        }

        parent::SoapClient($wsdl, ($options ? $options : array()));

        if ( in_array("https", $wrappers) ) {
            stream_wrapper_restore('https');
        }
        stream_wrapper_restore('http');

    }

CURLOPT_SSLVERSION to TLS

thybag SharePointAPI's php codes under Auth folder use CURLOPT_SSLVERSION 3.

As per http://php.net/manual/en/function.curl-setopt.php :
"Your best bet is to not set this and let it use the default. Setting it to 2 or 3 is very dangerous given the known vulnerabilities in SSLv2 and SSLv3."

I want it to use TLSv1 instead. If I do the following change I get code dump.

From
curl_setopt($ch, CURLOPT_SSLVERSION, 3);
To
curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1);

What would the best way to enable TLS or leave it at default? We do use NTLM.

If I do not make the above change I get SOAP-ERROR:
PHP Fatal error: SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://sharepoint/sites/subsite/_vti_bin/Lists.asmx?wsdl' : failed
to load external entity "https://sharepoint/sites/subsite/_vti_bin/Lists.asmx?wsdl"
in C:\xyz\Thybag\Auth\SoapClientAuth.php on line 67
PHP Fatal error: Uncaught exception 'Exception' with message 'Unable to locate WSDL file. faultcode=0,faultstring=SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://sharepoint/sites/subsite/_vti_bin/Lists.asmx?wsdl' :
failed to load external entity "https://sharepoint/sites/subsite/_vti_bin/Lists.asmx?wsdl"
' in C:\xyz\Thybag\SharePointAPI.php:183
Stack trace:
#0 test_thybag.php(24): Thybag\SharePointAPI->__construct('user', 'passwd', 'https://sha...', 'NTLM')
#1 {main}

thrown in C:\xyz\Thybag\SharePointAPI.php on line 183

If I use nusoap, for the same wsdl URL, I can successfully get list items as follows:
$listName=:MyList";
$rowLimit="1000";
$client = new nusoap_client($wsdl, true);
$client->setCredentials('', '', 'ntlm');
$client->setUseCurl(true);
$client->useHTTPPersistentConnection();
$client->setCurlOption(CURLOPT_USERPWD, 'user:passwd');
$xml ='

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

';
$result = $client->call('GetListItems', $xml); //This gets list items fine.

Please let me know what the fix is. Thanks.

addDocument

Thanks for such a great API !

I am trying to update /SharePointAPI.php to allow me to use the Copy.asmx?WSDL for the CopyIntoItems feature. Extrapolation from the modifyList function is pretty straight forward ... until I think about the actual execution of the CAML.

I suspect I need a separate Copy.asmx?WSDL-based soapClient->UpdateListItems -- with UpdateListItems being replaced as well. Any guidance on how it should be changed to handle the Copy.asmx?WSDL, instead of the Lists.asmx?WSDL that modifyList uses?

I still have some other items to work through, but for now I am mostly interested in the "// Attempt to run operation" part -- that way I can troubleshoot the other stuff.

Here is what I have so far:

/**
 * addDocument
 * Perform an action on a sharePoint library to either add content to it.
 * This method will call the SharePoint SOAP API with this data
 * to apply the changes.
 *
 * @param $strSourceURL Externally where the file comes from ???
 * @param $strDestinationURL Internally where to put the file, what should this look like ???
 * @param $arrFields Associative Array with keys (DisplayName, InternalName, Id, Value)
 * @param $b64Stream byte-64 encoding of the Source file's contents
 * @return Array|Object
 */
public function addDocument ($strSourceURL, $strDestinationURL, array $arrFields, $b64Stream) {
    // Wrap in CAML
    $strType = 'File'; // see https://[domain].sharepoint.com/[[site]/[subsite]]/_vti_bin/Copy.asmx?WSDL for other Types
    $CAML = '
    <CopyIntoItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">
        <SourceUrl>
            ' . $strSourceURL . '
        </SourceUrl>
        <DestinationUrls>
            <string>
                ' . $strDestinationURL . '
            </string>
        </DestinationUrls>
        <Fields>
            <FieldInformation>
                <Type>
                    ' . $strType . '
                </Type>
                <DisplayName>
                    ' . $arrFields['DisplayName'] . '
                </DisplayName>
                <InternalName>
                    ' . $arrFields['InternalName'] . '
                </InternalName>
                <Id>
                    ' . $arrFields['Id'] . '
                </Id>
                <Value>
                    ' . $arrFields['Value'] . '
                </Value>
            </FieldInformation>
        </Fields>
        <Stream>
            ' . $b64Stream . '
        </Stream>
    </CopyIntoItems>';
    $this->capturedCAML = $CAML;

    $xmlvar = new \SoapVar($CAML, XSD_ANYXML);
    $result = NULL;

    // Attempt to run operation
    try {
        //  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  vv  what should that be ????
        $result = $this->xmlHandler($this->soapClient->UpdateListItems($xmlvar)->UpdateListItemsResult->any);
    } catch (\SoapFault $fault) {
        $this->onError($fault);
    }

    // Return a XML as nice clean Array
    return $result;
}

date fields

Hello

When I try to update date fields in a SharePoint 2010 list, the update seems to fail although no exception is thrown. I am using the ISO 8601 date format - YYYY-MM-DD.

Here is an example of the data I am passing to the update method

Array
(
[SFId] => 001U000000Nwm90
[DBId] => 1036
[Title] => Organisation name
[Category] => Work-Based Learning provider
[Last_0x0020_Activity] => 2012-10-15
[Active] => 1
)

MAX_ROWS typo

On line 68 you have

if($limit==0 || $limit == null)$limit = $MAX_ROWS;

It should be

if($limit==0 || $limit == null)$limit = $this->MAX_ROWS;

Accessing Folders inside a List

I currently have several Sharepoint lists that have folders with additional files.

The read() function only returns the top level items (which is fine), what parameters do I need to pass inorder to get the items inside each folder?

Get version history for a list item, instead of a field

This code isn't ready to just pop in there, hence this isn't a pull request yet, however I felt I should pop it in here.

getVersions() should probably be changed to getFieldVersions(), and then this code could be added as getVersions(). It isn't fast, but it works. It's just something I was working with, so it isn't in the form of a function yet.

$fields = array();

foreach($promos->readListMeta('Promo Cal') as $field)
{
    $fields[] = $field['name'];
}

$versions = array();

foreach($fields as $field)
{
    try
    {
        $field_versions = $promos->getVersions('Promo Cal', '32', $field);
    }
    catch(Exception $e)
    {
        // Some fields generate a generic error
    }

    if(!empty($field_versions))
    {
        foreach($field_versions as $key => $value)
        {
            $versions[$key][strtolower($field)] = htmlspecialchars($value[strtolower($field)]);
        }
    }
}

Convert current test cases to PHPUNIT

  • Convert existing tests to PHPUNIT
  • Generalize code a little to make it usable without specific set up (list name/fields via config file)
  • Improve test coverage
  • Possibly try to establish a few different test environments

SharePointAPI -> read a list -> Unauthorized error

Anyone, has a idea, why I got an "Unauthorized" error message from the code below ?

// 0: include api in your php script.
require_once('../thybag/SharePointAPI.php');

$path_to_WSDL = escapeshellcmd("../thybag/lists.wsdl");
// 1: connect to SharePoint
$sp = new SharePointAPI($username, $pw, $path_to_WSDL);

// 2: read a list
$listContents = $sp->read('Announcements'); <<<<<<<<-------- $result = $this->xmlHandler($this->soapClient->GetListItems($xmlvar)->GetListItemsResult->any); ------>>>>> Unauthoritze error

Thank you in advance !

The security validation for this page is invalid.

Hi,

I tried to create sharepointlist to store candidate information. I encount the "The security validation for this page is invalid." while attach the file.
I am trying first time in php. I couldn't trace the issue.
This is my code.
$sp->addAttachment('applicant', 18, "files/PID.txt");

How do I resolve this issue? is there any syntax error in the code which I provided.
thanks

Catch exceptions correctly from SoapClientAuth

try/catches for the PHP SOAP api are only catching SoapFault's currently meaning that other Exceptions are not always handled correctly. (For example when one is thrown from the SoapClientAuth class)

Either switch Exceptions to be SoapFaults, or add ability handle normal exceptions also (need to find out if Soap will ever normally produce none soapfault exceptions)

"Looks like we got no XML document"

I had successfully implemented your API and have been using it for months. Then yesterday morning it had mysteriously stopped working. I checked the response in my Network tab and it says

"Looks like we got no XML document"

I don't believe I changed anything. I began debugging and dumped the response form the Authentication in the SharePointOnlineAuth.php __doRequest function. It displayed:

"403 Forbidden".

Is the "403 Forbidden" valid and they're now rejecting my authentication request?

I checked all the parameters being passed to the __doRequest function and $location was incorrect. I have the WSDL file URL as:

"https://mysharepointsite............/Lists.asmx?WSDL"

Which displays the XML correctly when going directly to the URL. But when I output $location it is missing the "?WSDL" query string. If I manually append it inside the function, the dump of $response contains the XML from the WSDL file. If I remove the dump the error in my Network tab now says "Error (VersionMismatch) Wrong Version".

I've tried setting SOAP version to SOAP_1_2 but no luck there.

Should the $location variable contain the querystring?

I'm using the "SPONLINE" authentication mode. Can you confirm the API still works for this and that Microsoft didn't break your code by changing something on their end in the last 2 days?

Please help.

Undefined method SharpointOnlineAuth::GetListCollection()

I think I'm missing something basic here, but when I try to call: $sp->getLists();
I'm getting 'call to undefined method GetListCollection.

Here is the line that is breaking for me in SharepointApi.php
$this->soapClient = new \Thybag\Auth\SharePointOnlineAuth($this->spWsdl, $options);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.