Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Event Handler Moving document from one doc. library to another

  Asked By: Chaim    Date: Apr 01    Category: Sharepoint    Views: 1408

I am trying to create small workflow in Sharepoint in Document Library.

I am catching events such as when the new document is

added to document library, or when the document is modified..

I am successful in moving documents with in the site. But I am facing problem when I am moving documents from one doc. Library to another doc. Library in another site.

I am writing a code in the event such that

when that event occurred, the document should automatically move to another site.

destUrl = destUrl + "/C2/Team Members/Customer Documents/" + foldername + "/" + filename;
SPWeb site_mv = new SPSite(destUrl).OpenWeb();

The above code is not working.

Can anybody please help…

Awaiting for a good solution..

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Sharonda Mcfarland     Answered On: Apr 01

Try this, where destSiteURL is the URL for the portal area or site  in which the destination document  library exists.

Using System.IO;
Using System.Web;

writer = new StringWriter();

req = new HttpRequest("", destSiteURL, "");

HttpContext context = new HttpContext(req, new HttpResponse(writer));

SPWeb site_mv = SPControl.GetContextWeb(context);

 




Tagged: