Reputation: 2895
I use Google Drive Api v3 with PHP. I have a google document - application/vnd.google-apps.document.
How can I get last modified time?
I tried:
$this->getClient()->files->get($id,[]);
And get empty all details, how to get last update date?
Google_Service_Drive_DriveFile {#1362 ▼
#collection_key: "spaces"
+appProperties: null
#capabilitiesType: "Google_Service_Drive_DriveFileCapabilities"
#capabilitiesDataType: ""
#contentHintsType: "Google_Service_Drive_DriveFileContentHints"
#contentHintsDataType: ""
+createdTime: null
+description: null
+explicitlyTrashed: null
+fileExtension: null
+folderColorRgb: null
+fullFileExtension: null
+headRevisionId: null
+iconLink: null
+id: "1WoKgfNSFN1sIDqbLNahTMe4Ds8rNygt2E8AkUcbO1qM"
#imageMediaMetadataType: "Google_Service_Drive_DriveFileImageMediaMetadata"
#imageMediaMetadataDataType: ""
+isAppAuthorized: null
+kind: "drive#file"
#lastModifyingUserType: "Google_Service_Drive_User"
#lastModifyingUserDataType: ""
+md5Checksum: null
+mimeType: "application/vnd.google-apps.document"
+modifiedByMeTime: null
+modifiedTime: null
+name: "+ 4.4 Szkolenia żeglarskie, REJSY SZKOLENIOWE"
+originalFilename: null
+ownedByMe: null
#ownersType: "Google_Service_Drive_User"
#ownersDataType: "array"
+parents: null
#permissionsType: "Google_Service_Drive_Permission"
#permissionsDataType: "array"
+properties: null
+quotaBytesUsed: null
+shared: null
+sharedWithMeTime: null
#sharingUserType: "Google_Service_Drive_User"
#sharingUserDataType: ""
+size: null
+spaces: null
+starred: null
+thumbnailLink: null
+trashed: null
+version: null
#videoMediaMetadataType: "Google_Service_Drive_DriveFileVideoMediaMetadata"
#videoMediaMetadataDataType: ""
+viewedByMe: null
+viewedByMeTime: null
+viewersCanCopyContent: null
+webContentLink: null
+webViewLink: null
+writersCanShare: null
#internal_gapi_mappings: []
#modelData: []
#processed: []
}
Is there another way to get this date?
Upvotes: 2
Views: 817
Reputation: 676
You should specify what fields you need, try this
$response = $this->service->files->get($fileId, array(
'fields' => 'id, name, modifiedTime',
// uncomment the following if you are working with team drive
//'supportsTeamDrives' => true
));
print_r($response);
I hope this will help
Take a look at my git repository for some helpful functions https://github.com/sazaamout/gDrive/blob/master/gDrive.php
Take a look at the following links for more information https://developers.google.com/drive/v3/web/search-parameters#file_fields
Upvotes: 1