Hi Marc,
thank you for your help. Let me first describe the setup. I use a document center and try to force the routing to the destination library. A normal update won't work to move the file. On a document center or recored center you have to use the web service OfficialFile.asmx. Previously I always got a 400 Bad Request.
Finally I found the solution to this problem. First the content of the file needs to be encoded to Base64 and the second thing is to wrap the content in a CDATA. After I added this to my code the routing works really charming.
Stefan
thank you for your help. Let me first describe the setup. I use a document center and try to force the routing to the destination library. A normal update won't work to move the file. On a document center or recored center you have to use the web service OfficialFile.asmx. Previously I always got a 400 Bad Request.
Finally I found the solution to this problem. First the content of the file needs to be encoded to Base64 and the second thing is to wrap the content in a CDATA. After I added this to my code the routing works really charming.
var moveFile = function (listItem, properties, byteData) {
var soap = '<?xml version="1.0" encoding="utf-8"?>\
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">\
<soap12:Body>\
<SubmitFile xmlns="http://schemas.microsoft.com/sharepoint/soap/recordsrepository/">\
<fileToSubmit><![CDATA[' + B64.encode(byteData) + ']]></fileToSubmit>\
<properties>\
' + properties + '\
</properties>\
<recordRouting>Test Document</recordRouting>\
<sourceUrl>' + host + "/" + fileServerRelativeUrl + '</sourceUrl>\
<userName>' + currentUserLoginName + '</userName>\
</SubmitFile>\
</soap12:Body>\
</soap12:Envelope>';
var xmlhttp = new XMLHttpRequest();
xmlhttp.open('POST', webUrl + '/_vti_bin/officialfile.asmx', true);
xmlhttp.setRequestHeader('Content-Type', 'application/soap+xml; charset=utf-8');
xmlhttp.setRequestHeader('SOAPAction', 'http://schemas.microsoft.com/sharepoint/soap/recordsrepository/SubmitFile');
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
deleteItem(listItem);
}
}
}
xmlhttp.send(soap);
};
Thank you for your proposal to help.Stefan