I am now developing a C# WPF application. And I found that I cannot get the file size. When I use File.Size.HasValue, it return false. But, I can get the filename and fileid successfully.
Can anyone help? Thank you.
The codes are shown below.
async Task ListRootFolder()
{
var items = await client.FoldersManager.GetFolderItemsAsync("0", 1000, autoPaginate: true);
var files = items.Entries.Where(i => i.Type == "file");
List tempNameList = new List();
List tempSizeList = new List();
List tempIdList = new List();
foreach (var file in files)
{
//*****BUG TO FIX*****
Console.WriteLine("boxfileSize:" + file.Size.HasValue.ToString());
tempNameList.Add(file.Name);
//*****BUG TO FIX*****
//tempSizeList.Add((float)file.Size);
tempIdList.Add(file.Id);
}
CloudFileInfo[] cloudFileInfos = new CloudFileInfo[tempNameList.Count];
for (int i = 0; i < cloudFileInfos.Length; i++)
{
cloudFileInfos[i].fileName = tempNameList[i];
cloudFileInfos[i].fileSize = 0;//*****BUG TO FIX***** //tempSizeList[i];
cloudFileInfos[i].fileId = tempIdList[i];
}
return cloudFileInfos;
}