This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DownloadFileEx not working anymore

Hello

We use the MFilesAPI in a C# application to first create a new object with a file (Word-document), update it so it is ready to print (which we do after downloading it) and

then download it using the method Vault.ObjectOperations.DownloadFileEx().

This used to work fine until a few days ago (probably after the august update was installed).

Since then we get the following error/exception when DownloadFileEx() is called:

CoVaultObjectFileOperations.cpp, 518, Unbekannter Fehler. (0x80004005)
ServerVaultObjectFileOperationsHelper.cpp, 216, Unbekannter Fehler. (0x80004005)
ServerVaultObjectFileOperationsHelper.cpp, 872, Unbekannter Fehler. (0x80004005)
LatestRPC.generated.cpp, 23263, Unbekannter Fehler. (0x80004005)
RPCDocumentOperationsFileIO.cpp, 1596, Unbekannter Fehler. (0x80004005)
RPCDocumentOperationsFileIO.cpp, 196, Unbekannter Fehler. (0x80004005)
RPCObjectFileOperationsHelper.cpp, 90, Unbekannter Fehler. (0x80004005)
MCallInLoop.h, 521, Unbekannter Fehler. (0x80004005)
RPCDocumentOperationsHelper.cpp, 20923, Unbekannter Fehler. (0x80004005)
ViewerFiles.cpp, 305, Unbekannter Fehler. (0x80004005)
ViewerFiles.cpp, 1148, Unbekannter Fehler. (0x80004005)
ViewerFileGenerator.cpp, 59, Unbekannter Fehler. (0x80004005)
ViewerFileGenerator.cpp, 155, Unbekannter Fehler. (0x80004005)
ViewerFiles.cpp, 575, Unbekannter Fehler. (0x80004005)
ViewerFiles.cpp, 1071, Unbekannter Fehler. (0x80004005)
ViewerFiles.cpp, 691, Unbekannter Fehler. (0x80004005)
(M-Files 23.8.12892.6 2023-09-12T11:34:01.284Z)

The code which downloads the file is the following and was not changed:

// update the metadata in file so it is ready to print
ObjectVersion checklistToUpdate = InventoryVault.ObjectOperations.CheckOut(newChecklist.ObjVer.ObjID);
InventoryVault.ObjectFileOperations.UpdateMetadataInFile(
    checklistToUpdate.ObjVer, -1, true);
ObjectVersion updatedChecklist = InventoryVault.ObjectOperations.CheckIn(checklistToUpdate.ObjVer);

// prepare params for checklist download to temp
ObjectFile? checklistFile = null;
foreach (ObjectFile objFile in updatedChecklist.Files)
{
    checklistFile = objFile;
    break; // break after first file, since we only got one
}
if (checklistFile == null)
{
    throw new Exception("Checklist-File nicht gefunden!");
}
string filePath = System.IO.Path.Combine(
    System.IO.Path.GetTempPath(),
    System.IO.Path.GetTempFileName() + ".pdf");

// Download checklist as PDF
InventoryVault.ObjectFileOperations.DownloadFileEx(
    checklistFile.ID, checklistFile.Version, filePath, MFFileFormat.MFFileFormatDisplayOnlyPDF);

Any idea what is causing this issue?

Thanks in advance

Nicola

Parents
  • Perhaps try using the DownloadFileEx3 method and slightly change the code to work for that function?

    If that doesn't work, the MFilesAPI.Extensions namespace has OpenFileForReading(ObjectFile objectFile, Vault vault, MFFileFormat format) which returns a stream. It's not as easy as DownloadFileEx, but it works.

Reply
  • Perhaps try using the DownloadFileEx3 method and slightly change the code to work for that function?

    If that doesn't work, the MFilesAPI.Extensions namespace has OpenFileForReading(ObjectFile objectFile, Vault vault, MFFileFormat format) which returns a stream. It's not as easy as DownloadFileEx, but it works.

Children