Discuss this help topic in SecureBlackbox Forum

Clouds: Copy and move folders

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

C#:


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

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

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

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

As Google Drive allows a subfolder to have several parent folders, there is an overload of Move() method available, which accepts an array of destination folders.

Google Drive doesn't support copying of folders. So, if you call the Copy() method, a EElGoogleDriveServerError exception will be thrown with the error code of "badRequest".

How To articles about Google Drive cloud

Discuss this help topic in SecureBlackbox Forum