Nintex Connect

The Official Community Site for Nintex Software Products, including Nintex Workflow 2007, 2010 and 2013; Nintex Workflow for Project Server 2010; Nintex Reporting 2008 and Nintex Analytics 2010; Nintex Forms 2010; Nintex Live and Nintex SmartLibrary.
Welcome to Nintex Connect Sign in | Join | Help
in Search

Delete attachments?

Last post 05-25-2012, 3:33 PM by DouglasAkioka. 11 replies.
Sort Posts: Previous Next
  •  05-04-2010, 10:18 PM 10276

    Delete attachments?

    A simple question that I hope has a simple answer!

    How would I remove an attachment (all attachments) from a list item?

    Neal.

  •  05-05-2010, 4:51 AM 10284 in reply to 10276

    Re: Delete attachments?

    Hi nealbo,

    as there's no specific action for that, you'd probably need to use the Call Web Service action, and make a call to the SharePoint Lists.asmx web service.  It exposes a DeleteAttachment web method.

    http://<siteurl>/_vti_bin/Lists.asmx?op=DeleteAttachment

    MSDN : http://msdn.microsoft.com/en-us/library/lists.lists.deleteattachment.aspx

  •  05-12-2010, 12:38 AM 10396 in reply to 10284

    Re: Delete attachments?

    Thanks Vadim, That was very helpful - I managed to call the web service to get a text representation of the url of the attachments, I then split it into a collection and I've printed out each entry in the collection to check they are valid urls (they are) but when I try and use a foreach and use the variable each collection item is placed into to act as the url for Delete Attachments webservice I get Failed to process response. Error returned from server: The remote server returned an error: (400) Bad Request.

    The thing is if I manually enter the url (which I got from printing out each item of the url earlier!) it works fine.... I cannot understand why this would happen - what am I doing wrong??

    In my example below I have simplified it even further with there being only a single attachment so the getattachmentcollection in fact only returns a single url:

    Getattachmentcollection

    (You can't see but I've selected to return as text)

    DeleteAttachment
     

  •  05-12-2010, 12:53 AM 10397 in reply to 10396

    Re: Delete attachments?

    Hi Nealbo,

    I'd recommend using the Log in the History List action to log the variables ID and AB, but in the Log action, put a * at the start and end of the variables.

    Then run your workflow, and in your workflow histroy, you'll see whether there are erroneous spaces at the start or end of the variables.  That might be causing your issue.

  •  05-12-2010, 6:51 PM 10418 in reply to 10397

    Re: Delete attachments?

    Perfect! It seems that although text is chosen in the options that the surrounding xml is also saved. This must have been stripped out when I tested the variable's contents by writing to a field on the list. I managed to remove the surrounding xml and it is now working as it should.

    Thanks for your help Vadim, it's been invaluable!!

  •  05-13-2010, 3:34 AM 10426 in reply to 10418

    Re: Delete attachments?

    Excellent Nealbo. :)
  •  06-17-2011, 5:43 PM 17669 in reply to 10284

    Re: Delete attachments?

    I now have to figure out how to use Nintex to delete an InfoPath attachment. I'm a Nintex newbie, so I need more instruction on how I need to set up the Call Web Service actoin to call the SharePoint Lists.asmx web service. Can you help me?
  •  06-20-2011, 12:49 AM 17678 in reply to 17669

    Re: Delete attachments?

    Was thinking on this myself not 20minutes ago.. So this is not tested or proven.. but you could use the update XML action and just write a blank variable to the attachemnt XPATH

    This would replace the base64 data storade there..

  •  06-24-2011, 4:37 PM 17776 in reply to 17678

    Re: Delete attachments?

    Hi DanS,

    I haven't tried this either, but it's a damn good idea.

  •  05-25-2012, 2:15 PM 23165 in reply to 17776

    Re: Delete attachments?

    Hi everybody...

    I would like to ask some help for this scenario below:

    I have an InfoPath 2010 Form with a attachment control inside of a repeating table.

    At the first fill of the form, this control are showed and all users can upload files. After the first submit, I use Nintex Workflow 2010 ("Copy to SharePoint" action) to send all attachments to a library and return the folder's url to the form (because, after this step, all users will work with the document library to manage all attachments - so, I hide the attachment control of the InfoPath, for users not work with the same anymore).

    Until here, all process works fine!

    To complete my scenario, I want to remove all attachments of the InfoPath form (to compact the size of the xml). I know that all attachments into InfoPath are base64 encoded. I don't want to implement code into my InfoPath Form template.

    So, I try to use the "Update XML" Nintex Workflow Action to remove the attachments of the form.

    See below all tries that I did:

    1)Passing a Empty Value: I configured the action to pass no value. All the attachments were deleted. But the workflow notified me a error. I received this message: "The workflow could not update the item, possible because one or more columns for the item require a different type of information".

    2)Passing a Empty Variable (text with one line): I create a variable with the type "text with one line" without value (empty). All the attachments were deleted. But the workflow notified me a error. I received this message: "The workflow could not update the item, possible because one or more columns for the item require a different type of information".

    3)Passing a Empty File: In my case, as I will hide the Attachment Control, if I replace all files with a empty file, it will solve my problem. I try to update the file, passing a base64 Encode of a empty file "x0lGQRQAAAABAAAAAAAAAAUAAAAUAAAAQQB0AHQAYQBjAGgAbQBlAG4AdABFAG0AcAB0AHkALgB0AHgAdAAAAEVtcHR5" but the workflow replace all attachments but presents a workflow error, with the same messagem "The workflow could not update the item, possible because one or more columns for the item require a different type of information.

    4) As Adictional Test ...Passing the xml InfoPath node of a form without attachments: I create a item (using the same template there I want to remove all attachments) and, using the windows explorer view of the library, I edited the xml item into the notepad and i took the node of the attachments without a file.

    <my:Anexo xsi:nil="true"></my:Anexo>

    So I passed this part as a parameter into the "Update XML Action". And I configured the xpath without the last one nivel. It not worked. It broken the Form Schema. But if I configure this ...to add a child node...the action insert a line into the repeating table with a attachment control (without a file).

    So...parting of these tests, I would like to ask some help for one of this solution:

    a. Which parameter do I have to pass in my "Update XML" Action to delete all attachments?

    b. Which parameter (base64) do I have to pass in my "Update XML" Action to replace all attachments?

    c. Is there another way to remove or replace all attachments using Nintex Workflow (another action)?

    Thanks

    Best regards

    Douglas Akioka

     

     

  •  05-25-2012, 2:54 PM 23166 in reply to 23165

    Re: Delete attachments?

    I forgot something important

    ...as adictional information: Into the Xml file (InfoPath item), when the attachment control is empty, the node have some additional parameters: "xsi" "nil="true" Like this: ...

    <my:Anexo xsi:nil="true"></my:Anexo>

    But...with one file attached, this node is changed, and these aditional parameters are deleted. It is changed to a node like this:

    <my:Anexo>x0lGQRQAAAABAAAAAAAAACkAAAAMAAAAQQBuAGUAeABvADAAMgAuAHQAeAB0AAAAU0RGQVNBR1haQ1hYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFg=</my:Anexo>

    So...If i get some way to change the node...

    <my:Anexo xsi:nil="true"></my:Anexo>

     for...

    <my:Anexo></my:Anexo>

     ...I believe that will work.

    Is There a Way to change this information into the XML?

    Thanks Again

  •  05-25-2012, 3:33 PM 23167 in reply to 23166

    Re: Delete attachments?

    Another test there I did...

    I tried to pass the empty file (base64 encoded) using a variable and converting the same with the functions inline:

    FN-XmlEncode({WorkflowVariable:StringBase64})

    FN-XmlDecode({WorkflowVariable:StringBase64})

    But it not worked!

    Thanks

View as RSS news feed in XML
Powered by Community Server, by Telligent Systems