CopyIntoItems with fields different webs?

Feb 17, 2014 at 8:26 PM
Hello,
I have been using the SPServices plugin for the past couple of months to retire a few (relatively) clunky C# solutions. Needless to say, it has worked wonders.

I have however, run into a bit of a brick wall. I am using the CopyIntoItems service to Copy a file from one web to another. This was working perfectly after constructing it with MS Documents (.docx, .xlsx, etc). Then, a customer came to me saying that a .zip file copied over but did NOT take any of the properties with it. Here is my code below. I am just wondering, am I doing something wrong? Or is this a limitation in SP 2010?
        function copymoveDocument(dst, moveFlag){
            var docFileName = $listItemRow.attr("ows_EncodedAbsUrl");           var itemurl = docFileName;
            var itemfields = null;
            var itemstream = null;
            if(dst.indexOf("http://") <0 || dst.indexOf("https://") <0 ){
                dst = docFileName.substring(0,docFileName.indexOf("://")+3+docFileName.substring(docFileName.indexOf("://")+3).indexOf("/"))
                    +dst + $listItemRow.attr("ows_LinkFilename");
            }
            $().SPServices({
                operation: "GetItem",
                Url: itemurl,
                async: false,
                completefunc: function (xData, Status) {
                    itemstream = jQuery(xData.responseXML).find("Stream").text();
                    //$(xData.responseXML).find("Fields").xml();
                    //$(xData.responseXML).find("Fields").xml;
                    itemfields = $(xData.responseXML).find("Fields").get(0).xml;
                }
            });

            if(itemstream != "" && itemstream != "undefined" &&itemfields != null && itemfields != "undefined"){
                $().SPServices({
                    operation: "CopyIntoItems",
                    SourceUrl: $listItemRow.attr("ows_LinkFilename"),
                    async: false,
                    DestinationUrls: [dst],
                    Stream: itemstream,
                    Fields:itemfields,
                    completefunc: function (xData, Status) {
                        var error = $(xData.responseXML).find("CopyResult").first().attr("ErrorCode");
                        dst = $(xData.responseXML).find("CopyResult").first().attr("DestinationUrl");
                        if(moveFlag){
                            if(error == "Success"){
                                $("<div>Item moved successfully. <ul style='list-style:none;'><li>Original file: "+itemurl+ "</li><li>New file link: <a href='"+dst+"' >"+dst+"</a></li>"+
                                    "<li>New file location: <a href='"+dst.substring(0, dst.lastIndexOf("/")+1)+"' >"+dst.substring(0, dst.lastIndexOf("/")+1)+"</a></li></ul></div>").appendTo("#response");
                                deleteDocument();
                            }
                            else{
                                $("<div>Error moving item. incorrect source or destination url.</div>").appendTo("#response");
                            }
                        }
                        else{
                            if(error == "Success"){
                                
                                $("<div>Item moved successfully. <ul style='list-style:none;'><li>Original file: "+itemurl+ "</li><li>New file link: <a href='"+dst+"' >"+dst+"</a></li>"+
                                    "<li>New file location: <a href='"+dst.substring(0, dst.lastIndexOf("/")+1)+"' >"+dst.substring(0, dst.lastIndexOf("/")+1)+"</a></li></ul></div>").appendTo("#response");
                            }
                            else{
                                $("<div>Error copying item. incorrect source or destination url.</div>").appendTo("#response");
                            }
                        }

                        if(error == "Success"){
                        }
                    }
                });
            }
            else{
                $("<div>Error moving/copying item. incorrect source or destination url.</div>").appendTo("#response");
            }
        }