
Anonymous
,
Thank you so much for your help, I am really appreciate it.
I created a custom Action to copy documents from 1 library to other.
I deploy the code and put it under bin folder, I can see my action is available and I can add from the list. However I am getting the error on webpart refresh:
The following error occurs: Unable to retrieve the string from the resource list because the Resource List property is not defined.
Here is my code: ( I need to copy from library "Templates" to "Dest", this libraries are from different site collections).
public ActionResult Perform(CustomActionContext context, CustomActionCancelEventArgs evt)
{
ActionResult actionResult = new ActionResult();
SPWeb oWebsite=SPContext.Current.Web;
SPFolder oFolder=oWebsite.GetFolder("Templates");
SPFileCollection collFile=oFolder.Files;
//copy the files to list
List<SPFile> listfiles=new List<SPFile>(collFile.Count);
foreach (SPFile oFile in collFile)
{
listfiles.Add(oFile);
}
//copy the files
foreach(SPFile cfile in listfiles)
{
cfile.CopyTo("http://Name:8000/sites/MyTest/Dest/" + cfile.Name,true);
}
return actionResult;
}
}