DriveClientUpdateFile(FileInfo, String) Method
Updates (replaces) a existing file in the specified folder.
Namespace: DevCase.ThirdParty.Google.DriveAssembly: DevCase.net48.ThirdParty.GoogleServices (in DevCase.net48.ThirdParty.GoogleServices.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
public KeyValuePair<ResumableUpload, File> UpdateFile(
FileInfo srcFile,
string dstFileId
)
Public Function UpdateFile (
srcFile As FileInfo,
dstFileId As String
) As KeyValuePair(Of ResumableUpload, File)
Dim instance As DriveClient
Dim srcFile As FileInfo
Dim dstFileId As String
Dim returnValue As KeyValuePair(Of ResumableUpload, File)
returnValue = instance.UpdateFile(srcFile,
dstFileId)
public:
KeyValuePair<ResumableUpload^, File^> UpdateFile(
FileInfo^ srcFile,
String^ dstFileId
)
member UpdateFile :
srcFile : FileInfo *
dstFileId : string -> KeyValuePair<ResumableUpload, File>
No code example is currently available or this language may not be supported.
- srcFile FileInfo
-
The source file to upload.
- dstFileId String
-
The identifier of the existing file being updated.
KeyValuePairResumableUpload,
File
The resulting
KeyValuePairTKey, TValue.
This is a code example.
No code example is currently available or this language may not be supported.
Private Sub UpdateFile()
Dim client As New DriveClient("C:\GoogleSecrets.json", "yourmail@gmail.com", DriveScopes.Full)
Dim credential As UserCredential = client.Authorize()
Dim srcFile As New FileInfo("C:\File.ext")
Dim result As KeyValuePair(Of Google.Apis.Upload.ResumableUpload, Google.Apis.Drive.v3.Data.File) =
client.UpdateFile(srcFile, "Existing File Id.")
Dim upload As Global.Google.Apis.Upload.ResumableUpload = result.Key
Select Case upload.GetProgress().Status
Case Global.Google.Apis.Upload.UploadStatus.Failed
Console.WriteLine("Upload Failed.")
' To-Do: Retry/Resume Upload?:
' upload.Upload()
' upload.Resume()
Case Global.Google.Apis.Upload.UploadStatus.Completed
Dim dstFile As Global.Google.Apis.Upload.ResumableUpload = result.Value
Dim sb As New Global.System.Text.StringBuilder()
With sb
.AppendLine(String.Format("Id: {0}", dstFile.Id))
.AppendLine(String.Format("Name: {0}", dstFile.Name))
.AppendLine(String.Format("Size: {0}", dstFile.Size))
.AppendLine(String.Format("MIME type: {0}", dstFile.MimeType))
.AppendLine(String.Format("Date Created: {0}", dstFile.CreatedTime?.ToString()))
.AppendLine(String.Format("Url: {0}", If(dstFile.WebContentLink, dstFile.WebViewLink)))
.AppendLine(String.Format("Parent Folder Ids: {0}", String.Join(",", If(dstFile.Parents, {"nul"}))))
End With
Console.WriteLine(sb.ToString())
End Select
End Sub
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.