Joined: 03 Nov 2011 |
Posts: 2 |
|
|
|
Posted: Thu Nov 03, 2011 1:58 am |
|
|
|
|
|
Hi.
Sharepoint server with ntlm authorization. The request is successful, but added to the list is not one but 3 identical records with different ID
<?php
require_once('lib/nusoap.php');
$username = 'username';
$password = 'password';
$listName = "name";
$wsdl = "http://url/_vti_bin/Lists.asmx?WSDL";
$client = new nusoap_client($wsdl, true);
$client->setCredentials($username,$password, "ntlm");
$client->useHTTPPersistentConnection();
$client->soap_defencoding='UTF-8';
$arrData = array(
"Title"=>"title",
"Priority"=>"normal",
"Status"=>"start",
"PercentComplete"=>"0",
"Body"=>"test",
);
$items = '';
foreach($arrData AS $itm => $val){
$items .= "<Field Name='{$itm}'>{$val}</Field>\n";
}
$CAML ="<UpdateListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'>
<listName>{$listName}</listName>
<updates>
<Batch ListVersion='1' OnError='Continue'>
<Method Cmd='New' ID='1'>
{$items}
</Method>
</Batch>
</updates>
</UpdateListItems>";
$result = $client->call('UpdateListItems', $CAML,"","http://schemas.microsoft.com/sharepoint/soap/UpdateListItems");
if(isset($fault)) {
echo("<h2>Error</h2>". $fault);
}
$responseContent = htmlspecialchars(substr($client->response,strpos($client->response, "<"),strlen($client->response)-1));
echo "<h2>Request</h2><pre>" . $client->request . "</pre><br>";
echo "<h2>Response header</h2><pre>" . $client->response . "</pre><br>";
echo "<h2>Response content</h2><pre>".$responseContent."</pre><br>";
unset($client);
|
PS Sorry for my english.
|
|