Please go to this post to understand what JS files you need to download to achieve the required functionality.
var strSiteUrl = "http://SPSERVER:100";
var objList = new SPAPI_Lists(strSiteUrl);
var strHTML = "";
function BindSharedDocuments()
{
var sQuery = "<Query><OrderBy><FieldRef Name='ID' Ascending='False' /></OrderBy></Query>";
var strViewFields = "<ViewFields><FieldRef Name='BaseName' /><FieldRef Name='EncodedAbsUrl' /></ViewFields>";
var result = objList.getListItems("UserPages", "", sQuery, strViewFields, "", "<QueryOptions><ViewAttributes Scope='Recursive' /></QueryOptions>", "");
var ItemRows = '';
if ($.browser.webkit)
{
ItemRows = "row";
}
else
{
ItemRows = "z\\:row";
}
strHTML+="<Table width='100%' cellpadding='0' cellspacing='0'>";
strHTML+="<Tr>";
strHTML+="<Td>";
strHTML+="Document Name";
strHTML+="</Td>";
strHTML+="</Tr>";
alert($(result.responseXML).find(ItemRows).length);
if ($(result.responseXML).find(ItemRows).length > 0)
{
$(result.responseXML).find(ItemRows).each(function ()
{
strHTML+="<Tr>";
strHTML+="<Td>";
strHTML+="<A href='"+$(this).attr('ows_EncodedAbsUrl')+"'>"+$(this).attr('ows_BaseName')+"</a>";
strHTML+="</Td>";
strHTML+="</Tr>";
});
}
strHTML+="</Table>";
$("#divSharedDocuments").html(strHTML);
}
$(document).ready(function()
{
BindSharedDocuments()
});
var strSiteUrl = "http://SPSERVER:100";
var objList = new SPAPI_Lists(strSiteUrl);
var strHTML = "";
function BindSharedDocuments()
{
var sQuery = "<Query><OrderBy><FieldRef Name='ID' Ascending='False' /></OrderBy></Query>";
var strViewFields = "<ViewFields><FieldRef Name='BaseName' /><FieldRef Name='EncodedAbsUrl' /></ViewFields>";
var result = objList.getListItems("UserPages", "", sQuery, strViewFields, "", "<QueryOptions><ViewAttributes Scope='Recursive' /></QueryOptions>", "");
var ItemRows = '';
if ($.browser.webkit)
{
ItemRows = "row";
}
else
{
ItemRows = "z\\:row";
}
strHTML+="<Table width='100%' cellpadding='0' cellspacing='0'>";
strHTML+="<Tr>";
strHTML+="<Td>";
strHTML+="Document Name";
strHTML+="</Td>";
strHTML+="</Tr>";
alert($(result.responseXML).find(ItemRows).length);
if ($(result.responseXML).find(ItemRows).length > 0)
{
$(result.responseXML).find(ItemRows).each(function ()
{
strHTML+="<Tr>";
strHTML+="<Td>";
strHTML+="<A href='"+$(this).attr('ows_EncodedAbsUrl')+"'>"+$(this).attr('ows_BaseName')+"</a>";
strHTML+="</Td>";
strHTML+="</Tr>";
});
}
strHTML+="</Table>";
$("#divSharedDocuments").html(strHTML);
}
$(document).ready(function()
{
BindSharedDocuments()
});
No comments:
Post a Comment