(
source code)
webService(options, operation, service, properties, webURL, soapURL, soapAction)
Permits to directly deal with a WebService (similar to SPServices http://sympmarc.github.io/SPServices/core/web-services.html)
Parameters:
String
operation
The method name to use (e.g. UpdateList, GetList, ....)
String
service
The name of the service (Lists, Versions, PublishedLinksService, ...) it's the ".asmx" name without the extension
Object
properties Optional, Default: {}
The properties to call
String
webURL Optional, Default: current website
The URL of the website
String|Boolean
soapURL Optional, Default: 'http://schemas.microsoft.com/sharepoint/soap/'
If the SOAP url is not the default one, then you can customize it... it will be send in the request's headers as "SOAPAction"
Boolean
soapAction Optional, Default: true
Some web services don't want the "SOAPAction" header
Returns:
Promise
resolve(responseBody), reject(see $SP().ajax())
Example:
$SP().webService({ // http://sympmarc.github.io/SPServices/core/web-services/Lists/UpdateList.html
service:"Lists",
operation:"Updatelist",
webURL:"http://what.ever/"
properties:{
listName:"Test",
listProperties:"...",
newFields:"...",
updateFields:"...",
deleteFields:"...",
listVersion:"..."
}
}).then(function(response) {
// do something with the response
}, function(error) {
console.log("Error => ",error)
});
// to remove a person from a group
$SP().webService({
service:"UserGroup",
operation:"RemoveUserFromGroup",
soapURL:"http://schemas.microsoft.com/sharepoint/soap/directory/",
properties:{
groupName:"Group",
userLoginName:"domain\\user"
}
}).then(function(response) {
console.log("OK => ",response)
}, function(error) { console.log("Error => ",error) });