Windows SharePoint Services comes with sixteen different web services. The web service interface makes it very easy to integrate SharePoint capabilities right into our application. The web services provided by SharePoint helps us in doing a number of things easily. But not all SharePoint features are accessible through them. If required we can build our own web service.
List of available WSS Web Services and their web references:
1. Alerts Service http://server-url/_vti_bin/alerts.asmx
2. Document Workspace Service http://server-url/_vti_bin/dws.asmx
3. Forms Service http://server-url/_vti_bin/forms.asmx
4. Imaging Service http://server-url/_vti_bin/imaging.asmx
5. List Data Retrieval Service http://server-url/_vti_bin/dspsts.asmx
6. Lists Service http://server-url/_vti_bin/lists.asmx
7. Meetings Service http://server-url/_vti_bin/meetings.asmx
8. Permissions Service http://server-url/_vti_bin/permissions.asmx
9. Site Data Service http://server-url/_vti_bin/sitedata.asmx
10.Site Service http://server-url/_vti_bin/sites.asmx
11.Users and Groups Service http://server-url/_vti_bin/usergroup.asmx
12.Versions Service http://server-url/_vti_bin/versions.asmx
13.Views Service http://server-url/_vti_bin/views.asmx
14.Web Part Pages Service http://server-url/_vti_bin/webpartpages.asmx
15.Webs Service http://server-url/_vti_bin/webs.asmx
16.Administration Service http://server-url:port/_vti_adm/admin.asmx
To check the available web methods of a WSS Web service just open the web reference in the browser and you will find the available web methods and by clicking those methods link you can check the method description.
I found WSS Web Service very useful when updating an items ECB dynamically. I was needed to show or hide ECB link on the basis of some settings stored in Content Type. I have listTitle and ItemId in my hand and I need to get the XmlDocuments Collection of the content Type associated with that list item.
In my first step I planned to retreive Content type id. To do this I used GetListItems web method of http://server-url/_vti_bin/lists.asmx web service. To get the Soap message and Soapaction of that web method use the description of GetListItems web method. In my second step I will use that content type id in association with the list in the GetListContentType web method of same web service to get the xmldocuments collection of that content type and check the setting on the basis of which I will show or hide the ECB link. For your reference I am giving you the methods which can help you.
// Method to instantiat the Soap request
function InstanciateHttpRequest() {
var Obj;
if (window.XMLHttpRequest) {
Obj = new XMLHttpRequest();
}
else {
Obj = new ActiveXObject("Microsoft.XMLHTTP");
}
return Obj;
}
function GetContentTypeSettingStatus(rootSiteUrl, ListTitle, itemId)
{
var cTypeId = '';
var responseXML;
var IsSettingEnabled = false;
var ws;
try {
ws = InstanciateHttpRequest();
if (ws != null)
{
var soap = GetContentTypeId(ListTitle, itemId);
ws.open("POST", rootSiteUrl + "/_vti_bin/lists.asmx", false);
ws.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
ws.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/sharepoint/soap/GetListItems");
ws.send(soap);
if (ws.readyState == '4' && ws.status == '200') {
responseXML = ws.responseXML.xml;
cTypeId = process responseXML xml document and get content type id value;
}
if (cTypeId != null) {
var soapXmlDocument = GetXmlDocument(ListTitle, cTypeId);
ws.open("POST", rootSiteUrl + "/_vti_bin/lists.asmx", false);
ws.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
ws.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/sharepoint/soap/GetListContentType");
ws.send(soapXmlDocument);
if (ws.readyState == '4' && ws.status == '200') {
responseXML = ws.responseXML.xml;
IsSettingEnabled = this responseXML xml document contains content type settings. You need to process that and retreive your required xmlDocument setting;
}
}
}
}
catch (e)
{ }
return IsSettingEnabled;
}
function GetContentTypeId(listName, itemId) {
var soap = "<?xml version='1.0' encoding='utf-8'?>" +
"<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>" +
"<soap:Body>" +
"<GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'>" +
"<listName>" + listName + "</listName>" +
"<query><Query><Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + itemId + "</Value></Eq></Where></Query></query>" +
"<viewFields><ViewFields><FieldRef Name='ContentTypeId' /></ViewFields></viewFields>" +
"<rowLimit>1</rowLimit>" +
"<queryOptions><QueryOptions><ViewAttributes Scope='Recursive'></ViewAttributes></QueryOptions></queryOptions>" +
"</GetListItems>" +
"</soap:Body>" +
"</soap:Envelope>";
return soap;
}
function GetXmlDocument(listName, cTypeId) {
var soap = "<?xml version='1.0' encoding='utf-8'?>" +
"<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>" +
"<soap:Body>" +
"<GetListContentType xmlns='http://schemas.microsoft.com/sharepoint/soap/'>" +
"<listName>" + listName + "</listName>" +
"<contentTypeId>" + cTypeId + "</contentTypeId>" +
"</GetListContentType>" +
"</soap:Body>" +
"</soap:Envelope>";
return soap;
}
Many Thanks
No comments:
Post a Comment