Storages & Files CopyElementTo
CopyElementTo method

Copies an element (item) contained in the storage to another storage.

Syntax:

variable = object.CopyElementTo( element_name, target_storage, target_element_name)

Parameters:

target_storage - other SFStorage object.
element_name - name of the item (element) to copy
target_element_name - name of the copied element in the target storage.

Remarks:

This will transfer any element from any storage to any storage. If the operation is impossible false will be returned. Operation is optimized internally if the both storages are of the same type. For example for two directory storages (opened directories using SFMain object for example) this will be simply a file/directory copy operation. If the both storages are different then the operation will be performed using the IStorage and IStream public methods. For example this method will copy a file from the file-system to an OLE compound file's storage if the first storage is a directory and the second is a storage in OLE compound file.

Note that different storages have different requirements for the element names, some limitations (such as no nesting for example) etc. Thus the method will fail if these requirements are not met. If strict error handling is required and the logic of your application allows you to know the types of the both storages it is recommended to check if the copied element meets the requirements of the target storage before performing the operation. For the case of mixed usage of OLE compound files and directories there are only a few requirements (see OLE compound files). 

Applies to: SFStorage object

See also: MoveElementTo, CopyTo

newObjects Copyright 2001-2006 newObjects [ ]