I have a custom JavaScript-based page that allows users to create a list of links to files in other locations. I'm now looking for a way to provide the Modified date as additional information appended to the end of the link text. That is, if a user provides the text My File and links it to a file at location sharepointsite.com/sites/unit/subUnit/Shared Documents/Folder 1/Subfolder 1/My File.docx, after the script runs the text should read My File (4/25/2014). The date format isn't so relevant as the fact that it appears.
I've gotten the script to the point where I can determine the path and file name, and pass these variables into GetListItems, but I seem to be having problems with the syntax of GetListItems. Can you spot anything wrong here?
actualFilePath: "/sites/unit/subUnit/"
actualListName: "Shared Documents"
actualFileName: "Shared Documents/Folder/Subfolder/FileName.docx"
The purpose for using variables is because file paths are going to vary from file to file. I'm not sure if the problem exists in the data I'm passing, the GetListItems syntax, or a combination of the two.
Thanks for any help you can provide!
I've gotten the script to the point where I can determine the path and file name, and pass these variables into GetListItems, but I seem to be having problems with the syntax of GetListItems. Can you spot anything wrong here?
$().SPServices({
operation: "GetListItems",
async: false,
webURL: actualFilePath,
listName: actualListName,
CAMLViewFields: "<ViewFields><FieldRef Name='FileRef' /><FieldRef Name='Title' /><FieldRef Name='Modified' /></ViewFields>",
CAMLQuery: "<Query><Where><Eq><FieldRef Name='FileRef' /><Value Type='Url'>" + actualFileName + "</Value></Eq></Where></Query>",
completefunc: function (xData, Status) {
itemTitle = $(this).attr("ows_Title");
itemMod = $(this).attr("ows_Modified");
// Apply the modified date to the text
}
});
Currently, the itemTitle and itemMod assignments are returning undefined. The variables I'm passing into GetListItems contain information somewhat like this:actualFilePath: "/sites/unit/subUnit/"
actualListName: "Shared Documents"
actualFileName: "Shared Documents/Folder/Subfolder/FileName.docx"
The purpose for using variables is because file paths are going to vary from file to file. I'm not sure if the problem exists in the data I'm passing, the GetListItems syntax, or a combination of the two.
Thanks for any help you can provide!