views:

226

answers:

1

Hi there, I currently have a task list, some of them contain file attachments. As part of a new workflow I'm creating in MOSS Designer I need to copy the attachments to files in a document library. What is the best way to do this? Is there an activity already made for this? Thanks!

+1  A: 

Hi,

I know it is an old question but for someone out there..

private void MoveAppraisalSupportDocs(SPListItemCollection sourceDocsList, SPList destinationDocsLib)
        {
            int sourceDocCnt = sourceDocsList.Count;

            if (sourceDocCnt > 0)
            {
                for (int sd = 0; sd < sourceDocCnt; sd++)
                {
                    SPListItem sourceItem = sourceDocsList[sd];
                    byte[] fileBytes = sourceItem.File.OpenBinary();
                    string destUrl = destinationDocsLib.RootFolder.Url + "/" + sourceItem.File.Name;
                    SPFile destFile = destinationDocsLib.RootFolder.Files.Add(destUrl, fileBytes, true /*true means overwrite */);
                }
            }
        }
Naren
Holy Necrothread! But hey you got it...
tekiegreg