locked
Delete attachment from the list item via SPD workflow RRS feed

  • Question

  • Is it possible to delete attachment from the list item via SharePoint designer workflow when item has been updated?
    • Moved by Mike Walsh FIN Monday, July 25, 2011 8:51 AM wf q (From:SharePoint - Design and Customization (pre-SharePoint 2010))
    Monday, July 25, 2011 6:22 AM

All replies

  • We cannot manage attachments using SharePoint Designer OOB, however you could create a custom action in SPD, Refer to the following article for more information

    http://msdn.microsoft.com/en-us/library/bb629922(v=office.12).aspx#Y600

     

    Also refer to the following post from CodePlex on custom activities

    http://spdactivities.codeplex.com/wikipage?title=Copy%20List%20Item%20Extended%20Activity&ProjectName=spdactivities


    --Cheers
    Monday, July 25, 2011 6:30 AM
  • Hi,

    Follow these steps:

    1. Open the site in SPD

    2. Go to file-->new--> Workflow

    3. Select the third option when the item is changed.

    4. Select the list

    5. Select the action as update item and specify the action as set attachement as No.

    I hope this will help you out.

    Thanks,

    Rahul Rashu

    Monday, July 25, 2011 8:51 AM
  • Hi Rahul,

    If I do that then I get unknown error from the workflow. Any idea? And did it work for you?

    Tuesday, July 26, 2011 4:29 AM
  • Hi,

    I had created the workflow for you. I will try the same in my dev box to see if it throws any error or not. Meanwhile I suggest you to switch on verbose mode and capture logs to find out exactly where the error happens.

    Thanks,

    Rahul Rashu

    Tuesday, July 26, 2011 5:19 AM
  • Hi Rahul, could you please tell me what is verbose mode? Or please elaborate how do I do that? Have not used this before.
    Thanks.

    Tuesday, July 26, 2011 5:53 AM
  • To delete attachments from the list item, you can create a custom SDP activity or use ready to use from third-party spd activities kit.
    Senior Software Developer - Virtosoftware - Premium Web Parts for Microsoft SharePoint 2007 & 2010
    Tuesday, July 26, 2011 5:59 AM
  • I am actually looking for a way by using SPD, not by creating custom SDP activity.

    I have looked at spd activities, but have not seen any activity there, which one you are refering to?

    Tuesday, July 26, 2011 6:17 AM
  • I am actually looking for a way by using SPD, not by creating custom SDP activity.

    I have looked at spd activities, but have not seen any activity there, which one you are refering to?

    For example: Remove attachment and Remove all attachments from third-party activity kit


    Senior Software Developer - Virtosoftware - Premium Web Parts for Microsoft SharePoint 2007 & 2010
    Tuesday, July 26, 2011 6:27 AM
  • Hi,

    Verbose is a mode of logging. You can capture maximum details through it in logs.

    To enable it log in to your central admin--> Operation--> Diagonistic logging

    I hope this will help you out.

    Thanks,

    Rahul Rashu

    Tuesday, July 26, 2011 6:58 AM
  • Hi Rahul, Thanks for that, I am not too sure what should look there now, looked event log but nothing there.

    By the way, did it work for you when you put Attachments=No

    ?

    Tuesday, July 26, 2011 8:41 AM
  • I am actually looking for a way by using SPD, not by creating custom SDP activity.

    I have looked at spd activities, but have not seen any activity there, which one you are refering to?

    For example: Remove attachment and Remove all attachments from third-party activity kit


    Senior Software Developer - Virtosoftware - Premium Web Parts for Microsoft SharePoint 2007 & 2010

    Hi OlegO. _,

    Thanks for that.
    I have actually looked at http://spdactivities.codeplex.com/wikipage?title=Copy%20List%20Item%20Extended%20Activity&referringTitle=Home
    but seems like there is no option to specify not to copy attachment. As I could use different option like copy the item to the same list and then delete old one.

     

    Tuesday, July 26, 2011 8:47 AM
  • HI,

    You need to check this in ULS logs. I checked the same after replicating the error , the error message captured in ULS log is

    07/26/2011 23:30:05.31 w3wp.exe (0x11D0)                       0x1874 Windows SharePoint Services   Workflow Infrastructure       98d4 Unexpected Microsoft.SharePoint.SPException: Attachment field cannot be updated.     at Microsoft.SharePoint.SPListItem.SetValue(String strName, Object value, SPField field, Boolean protectFields)     at Microsoft.SharePoint.SPListItem.SetValue(String strName, Object value, Boolean protectFields)     at Microsoft.SharePoint.SPListItem.set_Item(String fieldName, Object value)     at Microsoft.SharePoint.Workflow.SPWinOEWSSService.ApplyFieldValuesToListItem(SPListItem theSPItem, Hashtable itemProperties)     at Microsoft.SharePoint.Workflow.SPWinOEWSSService.SetFieldsInListItem(SPListItem theSPItem, Hashtable itemProperties)     at Microsoft.SharePoint.Workflow.SPWinOEWSSService.UpdateListItem(Guid id, Guid listId, Int32 itemId, Hashtable itemProperties)     at Microsoft.SharePoint.WorkflowActions.Acti...

    Thanks,

    Rahul Rashu

    Tuesday, July 26, 2011 6:10 PM