cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
mai-kel
Nintex Newbie

Copy list item from one site to another including attachements

Jump to solution

I build a workflow with two steps: first step is to copy the list item itself with "create element in another website" which works fine.

 

Now I want to copy the attachment(s) as well and used the "web service call AddAttachment":

 

SOAP:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:m="http://schemas.microsoft.com/sharepoint/soap/">
  <soap:Header>
  </soap:Header>
  <soap:Body>
    <m:AddAttachment>
      <m:listName>https://xxx.yyy.de/Feedbackmanagement/Lists/FeedbackmanagementNeu</m:listName>
      <m:listItemID>{WorkflowVariable:lidNeueElementID}</m:listItemID>
      <m:fileName>{ItemProperty:FileLeaveRef}</m:fileName>
      <m:attachment>base64Binary</m:attachment>
    </m:AddAttachment>
  </soap:Body>
</soap:Envelope>

 

Unfortunately I receive the following error message:
soapSmiley FrustratederverException of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown. List does not exist. The page you selected contains a list that does not exist. It may have been deleted by another user. 0x82000006

 

But the list exists. I can copy the string "https://xxx.yyy.de/Feedbackmanagement/Lists/FeedbackmanagementNeu" out of the web service call and the list opens.

 

What am I doing wrong?!?

 

 

Labels: (1)
0 Kudos
Reply
18 Replies
emha
Nintex Newbie

Re: Copy list item from one site to another including attachements

Jump to solution

list name should have been its name (title) or GUID, not URL

0 Kudos
Reply
mai-kel
Nintex Newbie

Re: Copy list item from one site to another including attachements

Jump to solution

Does that mean that I am only able to add attachements with this web service call within the site collection I am currently in?!

0 Kudos
Reply
nj
Nintex Newbie

Re: Copy list item from one site to another including attachements

Jump to solution

No, I don't think that's what @emha is saying. The first field you specify on the Call web service action is the URL. The listName field is just the name of the list on the site you specify in the URL field.

Reply
mai-kel
Nintex Newbie

Re: Copy list item from one site to another including attachements

Jump to solution

OK, I think I am slowly  getting there...

I now have a problem, with this line:

<m:fileName>{ItemProperty:FileLeaveRef}</m:fileName>

 

It seems that {ItemProperty:FileLeaveRef} is not resolved by NINTEX.....

 

Any ideas why?!

0 Kudos
Reply
emha
Nintex Newbie

Re: Copy list item from one site to another including attachements

Jump to solution

yes, @nj is right, site URL where do you call web service from denotes where target list is being looked for.

 

reg. FileLeaveRef - do you expect it contains attachment(s) name(s)? that's not the case. write it to history log to see its content.

you will have to get attachment(s) name(s) either from hidden nintex's column FormData or from sharepoint by a call to Lists.asmx webservice

0 Kudos
Reply
mai-kel
Nintex Newbie

Re: Copy list item from one site to another including attachements

Jump to solution

Okay. So with that (web service "GetAttachmentCollection") I was able to retrieve the file names and in a second step I was  able to copy the attachments into the list. I tested it with two attachments, both were attached to the list entry I wanted.

 

So far so good!

 

BUT it seems that the files have been corrupted. What could be the reason for that?

I attached a *.txt file and a *.docx file.

 

Opening the copied *.txt file:

07-06-_2019_10-23-23.png

 

Opening the copied *.docx file:

07-06-_2019_10-26-01.png

(it says: Error opening the file in Word)

 

I would guess from Nintex point of view everything is configured correctly...

 

Cheers

mai-kel

 

 

 

0 Kudos
Reply
emha
Nintex Newbie

Re: Copy list item from one site to another including attachements

Jump to solution

how did you copied the content over?

have you base64 encoded it?

0 Kudos
Reply
mai-kel
Nintex Newbie

Re: Copy list item from one site to another including attachements

Jump to solution

I used the WS "AddAttachment" with the following service message:

 

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:m="http://schemas.microsoft.com/sharepoint/soap/">
<soap:Header>
</soap:Header>
<soap:Body>
<m:AddAttachment>
<m:listName>Feedbackmanagement</m:listName>
<m:listItemID>{WorkflowVariable:lidNeueElementID}</m:listItemID>
<m:fileName>{WorkflowVariable:slotAttachmentShort}</m:fileName>
<m:attachment>base64Binary</m:attachment>
</m:AddAttachment>
</soap:Body>
</soap:Envelope>

 

0 Kudos
Reply
mai-kel
Nintex Newbie

Re: Copy list item from one site to another including attachements

Jump to solution

I am pretty sure this is not working because of this line:

<m:attachment>base64Binary</m:attachment>

But I honestly have no clue what to write instead...

I have seen something like this, but that is also not working:

<m:attachment>FileData</m:attachment>

 

Maybe @vadim_tabakman has an idea, as he has already written some blog posts about this?!?

0 Kudos
Reply