Copy link to clipboard
Copied
I had written below function to read list item values from Sharepoint list but i am unable to find how to read the return value.
I am calling ShowDialog() function on menu item click. and below is my code. Please provide input how to read response of SOAP method. below code shows me error "Response is undefine"
function ShowDialog()
{
// Dialog Activation
app.beginPriv();
var listItemId = '1';
var title = 'new title again';
var listId = '{19736DC6-B732-4D25-8DAA-9E0FD808CA30}';
var siteUrl = 'http://pr-sharepoint.rothman.local/';
var batch =
'<Batch OnError="Continue">'+
'<Method ID="1" Cmd="Update">'+
'<Field Name="ID">' + listItemId + '</Field>'+
'<Field Name="Title">' + title + '</Field>'+
'</Method>'+
'</Batch>';
app.endPriv();
oDlg.strName = "Larry";
if( "ok" == app.execDialog(oDlg))
{
getDocTypeListItems(siteUrl, listId);
}
}
//helper function for get list item from web service
function getDocTypeListItems(siteUrl, listId)
{
var oAuthenticator ={ UsePlatformAuth: "true"};
var oRequest = {
soapValue: '<GetListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">'+
'<listName>' + listId + '</listName>'+
'<viewName>All Items</viewName>'+
'<query></query>'+
'<viewFields>Title</viewFields>'+
'<rowLimit></rowLimit>'+
'<queryOptions></queryOptions>'+
'<webID></webID>'+
'</GetListItems>'
};
var cAction = "http://schemas.microsoft.com/sharepoint/soap/GetListItems";
var ver = SOAPVersion.version_1_2;
var response = SOAP.request ({
cURL: siteUrl + "_vti_bin/lists.asmx",
oRequest:oRequest,
cAction:cAction,
oAuthenticate:oAuthenticator,
cResponseStyle: SOAPMessageStyle.Message,
bEncoded:false,
cVersion:ver
});
//var responseString = "http://pr-sharepoint.rothman.local/_vti_bin/lists.asmx?op=GetListItems";
//var result = response[responseString]["return"];
//var result = response['http://schemas.microsoft.com/sharepoint/soap/GetListItemsResponse']
//['http://schemas.microsoft.com/sharepoint/soap/GetListItemsResult'];
//app.alert(result);
}
Have something to add?