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

Removing file and FileVer parameter

Former Member
Former Member
I'm in dire straits in using some API features.
My software exports pdf files and put them in a vault. These file can be created in a single or multi file document (and this works fine).
If a file is exported more times, I should replace the file and put the new file.
Now, I tried to do this:
- destroy the document and re-create it (but I don't know why this doesn't work - see this post http://community.m-files.com/index.php?topic=1147.0)
- check-out the document, remove the file and put the new file in this way


Set oResults = oVault.ObjectSearchOperations.SearchForObjectsByConditions(arrCondizioni, MFilesAPI.MFSearchFlags.MFSearchFlagNone, False)
If oResults.Count > 0 Then
    oVault.ObjectOperations.CheckOut oResults(1).ObjVer.ObjID

    Dim objVersion As MFilesAPI.ObjVer
    Set objVersion = New ObjVer
    objVersion.SetObjIDAndVersion oResults(1).ObjVer.ObjID, CLng(oResults(1).ObjVer.Version) + 1

    oVault.ObjectFileOperations.RemoveFile objVersion, oResults(1).Files(1).FileVer
    oVault.ObjectFileOperations.AddFile objVersion, GetFileName(pathFile), "pdf", pathFile

[...]


When I call the ".RemoveFile" method, it throws an error saying "Not found."... I think that the way I set FileVer parameter is not correct... I didn't found informations about using FileVer...

Also, if the document is a "Single file document". the ".RemoveFile" throws an error saying that I can't remove a file from a single-file document... so, how can I replace this file?

If somebody can help me, I will be very grateful!!!
Thank you very much.

davides


Parents
  • Former Member
    Former Member
    I have same error when I try to remove a file, I got error single file document.

    How can we remove a single file document? Without the need to convert it to multi files document.

    Best regards,
Reply
  • Former Member
    Former Member
    I have same error when I try to remove a file, I got error single file document.

    How can we remove a single file document? Without the need to convert it to multi files document.

    Best regards,
Children
No Data