Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11508

FileNotFoundException in CopyActivity

$
0
0

Hi @ll

I created an activity which is supposed to copy an element from one library to another. I now at least managed to deploy it, see it in SPD and get rid of NullReferenceExceptions. However, now I get FileNotFoundException.

I copied my method below and how somebody can tell me what I'm doing wrong.

protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
  {
   try
   {
    using (SPSite srcSite = (SPSite)(__Context.Site))
    {
     using (SPWeb srcWeb = (SPWeb)(__Context.Web))
     {
      SPList lib = srcWeb.GetList( ("/libraries/my_lib");
      SPListItem item = lib.GetItemById(__ListItem);
      SPFile file = srcWeb.GetFile(item.UniqueId);
      string destinationURL = "http://myportal/myCopyLib/";
      SPFolder destination = srcWeb.GetFolder(destinationURL);
      CopyFile(file, destination, destinationURL);
      return ActivityExecutionStatus.Closed;
     }
    }
   }
   catch (System.Exception e)
   {
    throw e;
   }

  }

 

Thanks in advance,

Autumn


Viewing all articles
Browse latest Browse all 11508

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>