Discuss this help topic in SecureBlackbox Forum

Clouds: Copy and move files

To move a file use TElBoxFile.Move() method of the file object, which you want to move. Pass an object that identifies destination folder as the parameter.

C#:


// get an object for the target folder
TElBoxFolder targetFolder = storage.AcquireFolder(@"...");
Console.WriteLine("Target folder: {0} (id = {1})",
                  targetFolder.Name, targetFolder.ID);

// get an object for the file to be moved
TElBoxFile file = storage.AcquireFile(@"...");
Console.WriteLine("Original: {0} (parent = {1})", file.Name, file.ParentID);

// actually, move the file to the target folder
file.Move(targetFolder);
Console.WriteLine("Moved: {0} (parent = {1})", file.Name, file.ParentID);

// don't forget to release the objects
file.Release();
targetFolder.Release();

Copying is done in the same way as moving, using TElBoxFile.Copy() method of the file object, which you want to move. When copying you can specify the new name of the file in the destination folder. Copy method returns TElBoxFile object that corresponds to the newly created file.

C#:


// get an object for the target folder
TElBoxFolder targetFolder = storage.AcquireFolder(@"...");
Console.WriteLine("Target folder: {0} (id = {1})",
                 targetFolder.Name, targetFolder.ID);

// get an object for the file to be moved
TElBoxFile file = storage.AcquireFile(@"...");
Console.WriteLine("Original: {0} (parent = {1})", file.Name, file.ParentID);

// actually, copy the file to the target folder
TElBoxFile copiedFile = folder.Copy(targetFolder) as TElBoxFile;
Console.WriteLine("Copied: {0} (parent = {1})",
                 copiedFile.Name, copiedFile.ParentID);

// don't forget to release the objects
file.Release();
copiedFile.Release();
targetFolder.Release();

How To articles about Box.com cloud

Discuss this help topic in SecureBlackbox Forum