There is a good solution in SharePoint2010 (see my article SharePoint client programming series http://www.jb51.net/article/27198.htm for details), but it is not so good in SharePoint2007 Use it to analyze specific problems in detail. This article will solve the problem of how to access SharePoint data through WebService in JavaScript.
First you need to download the JavaScript API package from here (http://darrenjohnstone.net/download/12)
Referring to JS, there are two libraries in it. One package is the processing core library SPAPIcore.js, and the other package provides most of the interfaces for calling SPAPI_Lists.js
The most commonly used interface method is getListItems (listName, viewName, query, viewFields, rowLimit, queryOptions, webID)
The following is a problem often encountered during SPD custom development, obtaining user information:
function getCurrentUserStat()
{
var lists = new SPAPI_Lists('');
var items = lists.getListItems(
'UserInfo',
'',
'' _spUserId ' ', // query
'',
1 , // rowLimit
'' // queryOptions
);
Related information can be obtained by processing the returned XML file
if (items.status == 200)
{
var rows = items.responseXML.getElementsByTagName(' z:row');
if (rows.length == 1)
{
var dep = rows[0].getAttribute('ows_Department');
return rows[0].getAttribute ('ows_Department');
}
}
The call of this method is to send the request synchronously. In addition, if you want to know the detailed information of the attributes and values during debugging, you can Use alert(items.responseText) to view the returned results.
Reference:
http://darrenjohnstone.net/2008/07/22/a-cross-browser-javascript-api-for-the-sharepoint-and-office -live-web-services/Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn