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!
views:
226answers:
1
+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
2010-06-16 13:44:45
Holy Necrothread! But hey you got it...
tekiegreg
2010-06-16 17:31:54