Copy List Items to another list with attachment in Visual studio Workflow

i am looking for solution to Copy list item from one list to another list with attachment using visual studio workflow

i am able to copy list items but not attachment .if any one know how to copy attachment content from list one to list two

May 27th, 2015 5:46am

Hi,

Using this method you can copy attachments from one list item to another. You can add it to SharePoint workflow or any other action.

public void CopyItem(SPListItem srcItem, SPListItem destItem) 
{ 
    foreach (string attachmentName in srcItem.Attachments) 
    { 
        SPFile file = srcItem.ParentList.ParentWeb.GetFile(srcItem.Attachments.UrlPrefix + attachmentName); 
        byte[] data = file.OpenBinary(); 
        destItem.Attachments.Add(attachmentName, data); 
    } 
    destItem.Update(); 
}

Or try to use "Useful Sharepoint Designer Custom Workflow Activities".

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

Best Regards,

Dennis

Free Windows Admin Tool Kit Click here and download it now
May 27th, 2015 10:30pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics