Rename File in Google Drive

Hi,


I've been able to upload a file to a specific folder, however, I'd like to 
be able to rename that file? I have the TGDriveItem info for the file and I tried using the TADVGDrive.Update function, however, that did not update the file name.

Eric

Hi,


Unfortunately it's currently not supported to rename a file with TAdvGDrive on Google Drive.
However, this is a good suggestion and we'll investigate if this function can be added in a future version.

Hi,


I was able to get the rename function to work by using the HttpsPatch function.

  url := 'https://www.googleapis.com/drive/v2/files/' + gdriveitem.ID + '?access_token=' + Token_Access;

  AddHeader(headers, 'Content-Type', 'application/json');

  postdata := RawByteString('{'
    + '"title": "' + TMSUTF8Encode(ExtractFileName(newFileName)) + '"'
    + '}');

  Advgdrive1.HttpsPatch(ExtractServer(url),
                        RemoveServer(url),
                        Headers,
                        AnsiString(postdata),
                        resdat);

Hope this helps...

Eric

The next TMS Cloud Pack update will have built-in support for this.