Skip to main content

Using .Net Library.



var result = _boxClient.FilesManager…GetInfomationAsync(fileId, “file_version”)


returns file_version (Id and Version number)



But I need to get file version created_by and created_at.



I tried this.


var result = _boxClient.FilesManager…GetInfomationAsync(fileId, “file_version”, “created_at”, “created_by”)


it includes created_at and created_by for the original file; but not for the file version.



So I tried this:


var result = _boxClient.FilesManager…GetInfomationAsync(fileId, “file_version”, “file_version.created_at”, “file_version.created_by”)



and still does not work.



Any help?

Hi @ujjwalkarjee, welcome to the forum!



I’m a unfamiliar with the .Net SDK, however looking at the API there is a specific endpoint to get the file versions that include the created by, created on, etc, for each version.



So this:



curl --location 'https://api.box.com/2.0/files/1330646061259?fields=id%2Ctype%2Cname%2Cfile_version' \

--header 'Authorization: Bearer Zh...Y8' \



Returns:



{

"type": "file",

"id": "1330646061259",

"etag": "2",

"name": "BoxAPISingDemoDoc.pdf",

"file_version": {

"type": "file_version",

"id": "1456126847324",

"sha1": "d4f28b349bff3906af3714f319bdd5b3e680c404"

}

}



But if I query the file version end point:



curl --location 'https://api.box.com/2.0/files/1330646061259/versions' \

--header 'Authorization: Bearer Zh...Y8'



I get:



{

"total_count": 2,

"entries": :

{

"type": "file_version",

"id": "1456119548819",

"sha1": "d4f28b349bff3906af3714f319bdd5b3e680c404",

"name": "BoxAPISingDemoDoc.pdf",

"size": 206385,

"created_at": "2023-10-10T09:31:34-07:00",

"modified_at": "2023-10-10T09:31:34-07:00",

"modified_by": {

"type": "user",

"id": "18622116055",

"name": "Rui Barbosa",

"login": "barduinor@gmail.com"

},

"trashed_at": null,

"purged_at": null

},

{

"type": "file_version",

"id": "1456132264459",

"sha1": "d4f28b349bff3906af3714f319bdd5b3e680c404",

"name": "BoxAPISingDemoDoc.pdf",

"size": 206385,

"created_at": "2023-10-10T09:31:21-07:00",

"modified_at": "2023-10-10T09:31:21-07:00",

"modified_by": {

"type": "user",

"id": "18622116055",

"name": "Rui Barbosa",

"login": "barduinor@gmail.com"

},

"trashed_at": null,

"purged_at": null

}

],

"limit": 1000,

"offset": 0

}



There should be an equivalent endpoint in the .Net SDK.



Perhaps this one: Get Previous File Versions



Let us know if this helps.


Hi @ujjwalkarjee , as Rui has correctly pointed out, the full file information includes only minimal represenation of the current file version. To query more details about the version you’d need to use method ViewVersionsAsync on files manager. Please make sure to use the latest version of the SDK - v5.6.0.


Reply