currUser = $().SPServices.SPGetCurrentUser({
fieldNames: ["WorkEmail"], //Name (account name) is the default property
debug: false
});
currUserArr = $().SPServices.SPGetCurrentUser({
fieldNames: ["ID", "Name", "SIP Address"],
debug: false
});
currUser = $().SPServices.SPGetCurrentUser({
fieldNames: ["WorkEmail"], //Name (account name) is the default property
debug: false
});
currUserArr = $().SPServices.SPGetCurrentUser({
fieldNames: ["ID", "Name", "SIP Address"],
debug: false
});
<script language="javascript" type="text/javascript">
document.addEventListener("DOMContentLoaded", function(){
var url = location.href;
location = url.replace("SitePages/test.aspx", "_layouts/viewlsts.aspx");
});
</script>
Use the OOB application page: download.aspx
https://server/sites/site/_layouts/download.aspx?SourceUrl=https://filepath/
var searchtext ="string to be searched";
SharePoint 2010:
var queryText = "<QueryPacket xmlns='urn:Microsoft.Search.Query' Revision='1000'>";
queryText += "<Query>";
queryText += "<Context>";
queryText += "<QueryText language='en-US' type='MSSQLFT'>";
queryText += "SELECT SpSiteUrl, Title, Path, Description, HitHighlightedSummary, IsDocument";
queryText += "FROM Scope() WHERE FREETEXT(DEFAULTPROPERTIES, '";
queryText += searchtext;
queryText += "')And CONTAINS(Path, 'https://server/sites/site/subsite/library')";
queryText += "ORDER BY \"Rank\" DESC";
queryText += "</QueryText>";
queryText += "</Context>";
queryText += "<Range><Count>5000</Count></Range>";
queryText += "</Query>";
queryText += "</QueryPacket>";
SharePoint Online:
var queryText = "<QueryPacket xmlns='urn:Microsoft.Search.Query' Revision='1000'>"
queryText += "<Query>"
queryText += "<Range><Count>500</Count></Range>";
queryText += "<Context>"
queryText += "<QueryText language='en-US' type='STRING'>"
queryText += searchtext;
queryText += " Site:https://server/sites/site/subsite/library/";
queryText += "</QueryText>"
queryText += "</Context>"
queryText += "</Query>"
queryText += "</QueryPacket>";
//declare required variables
$().SPServices({//sart service call
operation: "Query",
queryXml: queryText,
async: false,
completefunc: function (xData, Status) {
$(xData.responseXML).find('CopyResult').attr('ErrorMessage'));
$(xData.responseXML).find("QueryResult").each(function () {
var x = $(this).text();
$(x).find("Document").each(function () {
url = $("Action>LinkUrl", $(this)).text();
if ((url.indexOf("site/subsite/library") > 0) &&
((url.indexOf("aspx")) == -1)) {
title = $("Title", $(this)).text();
size = $("Action>LinkUrl", $(this)).attr('size');
ext = $("Action>LinkUrl", $(this)).attr('fileExt');
desc = $("Description", $(this)).text();
//clear/reset variables
}
});
});
}
});//end service call