...
Code Block |
---|
ProjectService.CopyTo(IFolderItem targetContainer,IFolderItem sourceItem) { 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.Clone(); 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.RelocateRelocateTo(newPath); } } } |
A few things to note:
...