none
how to copy List item attachment to document library in SharePoint Designer workflows. RRS feed

  • Question

  • Hi,

    In SharePoint 2007 designer workflows how to copy List item attachment to document library(ex:shared documents).

    I know how to do from Document library to document library. I want to copy here attachment to library.

    Any help will be appreciated.


    Thanks & Regards, Neerubee
    Wednesday, August 4, 2010 11:51 AM

Answers

  • Using Custom SPD Activity only.

    Building Custom Activities for Use in SharePoint Designer

    How to read attachemnts:

    if (currentListItem.Fields.ContainsField("Attachments"))<br/>
    {<br/>
    	for (int i = 0; i < currentListItem.Attachments.Count; i++)<br/>
    	{<br/>
    		//attachments are actualy SPFiles stored in SPFolder that is part of our list<br/>
    		SPFile file = currentListItem.Web.GetFile(currentListItem.Attachments.UrlPrefix + currentListItem.Attachments[i]);<br/>
    <br/>
    		// TODO: Save to Document Library here<br/>
    	}<br/>
    }<br/>
    <br/>
    
    

    • Marked as answer by Seven M Friday, August 13, 2010 3:42 AM
    Wednesday, August 4, 2010 12:39 PM

All replies

  • Using Custom SPD Activity only.

    Building Custom Activities for Use in SharePoint Designer

    How to read attachemnts:

    if (currentListItem.Fields.ContainsField("Attachments"))<br/>
    {<br/>
    	for (int i = 0; i < currentListItem.Attachments.Count; i++)<br/>
    	{<br/>
    		//attachments are actualy SPFiles stored in SPFolder that is part of our list<br/>
    		SPFile file = currentListItem.Web.GetFile(currentListItem.Attachments.UrlPrefix + currentListItem.Attachments[i]);<br/>
    <br/>
    		// TODO: Save to Document Library here<br/>
    	}<br/>
    }<br/>
    <br/>
    
    

    • Marked as answer by Seven M Friday, August 13, 2010 3:42 AM
    Wednesday, August 4, 2010 12:39 PM
  • What if I don't have the option of creating a standalone environment for SharePoint development because I don't have a spare copy of Window Server just lying around?

    SharePoint is garbage.
    Wednesday, January 18, 2017 8:26 PM