I have created two document libraries: One acts as source library and the other is the destination document library.
I try to move files from source to destination. Upto here it is working fine.
But I am creating a new folder in the source document library. Now I want to move files from this new folder in the source library to the destination library .
I am following the code below but didn't get any solution. Can anyone please send process on how to do this?
protected override void OnLoad(EventArgs e)
{
if (!IsPostBack)
{
try
{
if (Request.QueryString["items"] != null && Request.QueryString["source"] != null)
{
string source = Request.QueryString["source"];
if (Request.QueryString["items"].ToString() != "")
{
string[] items = Request.QueryString["items"].ToString().Split('|');
lblerror.Text = "You have selected the following items to move:<br><br>";
lblerror.Visible = true;
source = source.Substring(1, source.Length - 2).ToLower();
Guid sourceID = new Guid(source);
SPDocumentLibrary sourceDocLib = (SPDocumentLibrary)SPContext.Current.Web.Lists[sourceID];
ListItems = new System.Collections.Generic.List<SPListItem>();
for (int i = 1; i < items.Length; i++)
{
SPListItem currentListItem = sourceDocLib.GetItemById(int.Parse(items[i]));
ListItems.Add(currentListItem);
lblerror.Text += currentListItem.Name + "<br>";
}
string check = Convert.ToString(ListItems[0].Name);
ViewState["currentListItem"] = check;
}
else
{
lblerror.Text = "You have not selected any document";
lblerror.Visible = true;
}
}
}
catch (Exception ex)
{
lblerror.Text += "Error : " + ex.Message;
lblerror.Visible = true;
}
}
}