I'm new to SharePoint development and using jquery for SP, so I'm having some difficulty with the following code:
Any suggestions are appreciated.
function copyItem(){
var srcurl="randomdirector.docx";
var desturl="randomdirectory.docx";
$().SPServices({
operation: "GetItem",
Url: srcurl,
completefunc: function (xData, Status) {
var itemstream = $(xData.responseXML).find("Stream").text();
var itemfields = [];
$(xData.responseXML).find("FieldInformation").each(function(){
itemfields.push($(this).get(0).xml);
});
$().SPServices({
operation: "CopyIntoItems",
SourceUrl: srcurl,
DestinationUrls: [ desturl ],
Stream: itemstream,
Fields:itemfields,
completefunc: function (xData, Status) {
}
})
}
});
The documents come over and show the "this is a linked document" with the "go to source" option available, etc. However, the only metadata field which seems to work actually go over is the Name field. Do I need to explicitly specify which fields are to be copied? Also, I'm not sure that the documents themselves are being copied since I have files, tables, etc. in the original document and none of those appear in the copied document despite there being an apparent link between the two.Any suggestions are appreciated.