Quantcast
Channel: jQuery Library for SharePoint Web Services
Viewing all articles
Browse latest Browse all 6517

New Post: Using CopyIntoItems to copy fields (document copy is successful)

$
0
0
I'm new to SharePoint development and using jquery for SP, so I'm having some difficulty with the following code:
    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.

Viewing all articles
Browse latest Browse all 6517

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>