Re-import Imported Package

In the GUI, if you attempt to import an previously imported return package, the user is prompted to confirm this is what they intend, and the package is then re-imported. Is the same functionality available via the SDK? The regular `.ImportReturnPackage` method on a FileBasedProject doesn't seem to provide any options, and indeed only throws an InvalidOperationException later with the stack trace below. Is there another approach to importing that can be taken?

Is it possible to recreate the functionality exposed in the GUI via the SDK?

Stack Trace:
This property is only available once the package has been imported.
   at Sdl.ProjectApi.Implementation.PackageOperation.get_Files()
   at Sdl.ProjectAutomation.FileBased.FileBasedProject.CreateReturnPackageImportObject(IReturnPackageImport rpi)
   at Sdl.ProjectAutomation.FileBased.FileBasedProject.ImportReturnPackage(String returnPackageFilePath, EventHandler`1 statusEventHandler, EventHandler`1 messageEventHandler)
   at Sdl.ProjectAutomation.FileBased.FileBasedProject.ImportReturnPackage(String returnPackageFilePath)

Parents Reply Children
  • I manage to reproduce your crash and there are 2 aspects of this issue:

    First of all there is a defect in the SDK because it shouldn't crash as it is. There is specific logic written for setting the failed status but is not working correctly. I will raise this with the development team because this should actually pass the correct status via the status event handler.

    Regardless of the above crash Studio SDK is not allowing to import the same return package more than once and it there is specific logic written for this. The crash is a side effect of this logic. I know that  Studio application is asking if you want to override the previous import but this behavior is not available in the SDK and I can't say if will ever be implemented.

    This leaves us with 2 options:

    1. You ask for a new return package. Every time the return package is generated by the translator it will have a unique identifier so you will not encounter the above issue.

    2. The second option is of last resort and only if the first option is not viable. This is because this is not officially supported in any way. So if you really need to do this you will have to manually parse your *.sdlproj and remove ReturnPackageImport xml element. This xml element has a PackageGuid attribute which you should compare against your return packageGuid and if the same remove ReturnPackageImport xml element from *.sdlproj.

    As I've said the second option is not supported and you might encounter some unexpected behavior.

    Romulus Crisan | Translation Productivity Development Manager | SDL | (twitter) @cromica_82 | (blog) http://www.romuluscrisan.com/

  • I have an additional question and it seems like this topic ist the right place for it [:)]

    Our main scenario is that we are sending an sdlppx package to a translator. The translator translates the package, generates a sdlrpx package and sends it back to us (via web upload). Behind the upload form there is an automated import process, which imports the sdlrpx package into the project (sdlproj). For the first upload, the import works fine.

    After the import, we have several quality assurance processes (automatic and / or manual). At this point, we make a decision whether the quality of the delivery is OK or not. If the quality is too bad, the delivery will be rejected and the translator will be informed to correct the delivery. Then, he needs to send a new sdlrpx package (there is no new sdlppx generated on our side when the delivery is rejected).

    When the translators uploads the corrected sdlrpx and we do the import again via SDK, the import fails because there has already been a previous import.

    So what do we need to do, so that the second delivery (or any later delivery) will be processed successfully?

    • Do we need to generate a new sdlppx package for the translator when we send the job back to him?
    • Do we need to reset anything inside the project (e.g. paragraph states, ...) before importing, or even before packing the sdlppx?
    • Is there anything else?

  • generating a new sdlppx should would be the preferred option

    Romulus Crisan | Translation Productivity Development Manager | SDL | (twitter) @cromica_82 | (blog) http://www.romuluscrisan.com/

  • It seems like the crash scenario still seems to occur in Studio 2015 SR2 (12.2.5087.4).
    Did you raise it already with the development team?