Das folgende Beispiel zeigt, wie ein Listenelement in den Ordner über Sharepoint JSOM API bewegen:
var listTitle = "Requests"; //list title
var itemId = 1; //list item id
var targetFolderUrl = "/Lists/Requests/Archive"; //target folder server relative url
var ctx = SP.ClientContext.get_current();
var list = ctx.get_web().get_lists().getByTitle(listTitle);
var item = list.getItemById(itemId);
ctx.load(item,['FileRef','FileDirRef']);
ctx.executeQueryAsync(
function(){
var fileUrl = item.get_item('FileRef');
var file = ctx.get_web().getFileByServerRelativeUrl(fileUrl);
var targetfileUrl = fileUrl.replace(item.get_item('FileDirRef'),targetFolderUrl);
file.moveTo(targetfileUrl, SP.MoveOperations.overwrite);
ctx.executeQueryAsync(
function(){
console.log('List item has been moved');
},
logError
)
},
logError);
function logError(sender,args){
console.log(args.get_message());
}
Für Sharepoint-spezifische Fragen finden Sie in der Sharepoint-Stapelaustausch sehen (http://sharepoint.stackexchange.com) Seite? ˅. –