Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
ProjectService.CopyTo(IFolderItem sourceItem ,IFolderItem targetContainer)
{
   if (!targetContainer can accept sourceItem)
      return;//should never get here we try to paste a folder in a model or something
   
   //clone the sourceItem
   var target = sourceItem.CloneDeepClone();
   var fileItems = target.GetAllItemsRecursive<IFileBased>();
   foreach (IFileBased fileBasedItem in fileItems)
   {
      //create a copy of the file if it is projectdata to prevent unwanted relations
      if (item is projectdata/internal)
      {
          string newPath = GetSomeNewGuidName();
          //this will copy internal and reconnect the file to the new source
          fileBasedItem.RelocateTo(newPath);
      }
   }
}

...