Discuss this help topic in SecureBlackbox Forum

Clouds: Copy and move files

To move a file to another folder use TElOneDriveFile.Move() method of a 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
TElOneDriveFolder targetFolder = storage.AcquireObject(@”...”) as TElOneDriveFolder;
Console.WriteLine("Target folder: {0} (id = {1})",
                  targetFolder.Name, targetFolder.ID);

// get an object for the file to be moved
TElOneDriveFile file = storage.AcquireObject(@"...") as TElOneDriveFile;
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();

To copy a file (TElOneDriveFile) to another folder, call its Copy() method and pass the destination folder to it. The method returns an object of the same type as a copied file is.

C#:


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

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

// actually, copy the file to the target folder
TElOneDriveFile copiedFile = file.Copy(targetFolder) as TElOneDriveFile;
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 OneDrive cloud

Discuss this help topic in SecureBlackbox Forum