Sharepoint Forum

 
Home » Forum » Sharepoint       Ask a questionRSS Feeds

Moving files between document libraries

  Asked By: Evelyn Little         Date: Dec 13, 2006      Category: Sharepoint      Views: 728
 

I wrote an event sink for a document library. I have all the code
working but one piece: If a field in the library is set to `Approved –
Final' I need to move the event file from that library to another
Document Library which is located in a sub-web of the parent web.
I understand that the `moveto' method will not work for files outside
the same site. Would I use the `add' method of the SPFileCollection ?
Here is the snippet of code I am trying to get to work but it keeps
error-ing with the Event Log message of "There is no file with that
URL in this web"

SPWeb site = new SPSite( <DestinationLibraryURL> ).OpenWeb();
byte[] binFile = <fileObjectToMove>.OpenBinary();
site.Files.Add(<DestinationLibraryURL>, binFile,true);


Do you know someone who can help? Share a link to this thread on twitter, or facebook.

Tagged:          

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on Moving files between document libraries Or get search suggestion and latest updates.


Your Answer
  • Answer should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].