Я пытаюсь сохранить документ Word в iManage с помощью ImportCmd из IMANEXTLib, и каждый раз при запуске я получаю новый экземпляр Word.
Я сохранил документ в doc1.doc, а затем:
'Connects to WorkSite
Dim dmsConnection As IManage.IManDMS = New IManage.ManDMSClass()
dmsConnection.ApplicationName = "My Application"
Dim sesCobbDms As IManage.IManSession = dmsConnection.Sessions.Add("DMS")
sesCobbDms.TrustedLogin()
'Initialisation
Dim hwndWord As Integer
Dim strTempCaption As String = Application.Caption
Application.Caption = "Hunting For Word"
hwndWord = MyApi.FindWindow("OpusApp", Application.Caption)
Application.Caption = strTempCaption
Dim intKeepCheckedOut As Integer
Dim docJustSaved As IManage.NRTDocument
Dim objImportCmd As IMANEXTLib.ImportCmd
Dim objContextItems As New IMANEXTLib.ContextItems
'Sets up ContextItems ready for save process
objContextItems.Add("ParentWindow", hwndWord)
objContextItems.Add("DestinationObject", sesCobbDms)
objContextItems.Add("IManExt.Import.FileName", NrPort & "\Doc1.doc")
'Note that we have to check it in and then back out again, otherwise it checks out to the wrong place
intKeepCheckedOut = IManage.CheckinOptions.nrDontKeepCheckedOut
objContextItems.Add("IManExt.Import.KeepCheckedOut", intKeepCheckedOut)
'Forces a blank description
objContextItems.Add("ImanExt.Import.DocDescription", "")
objImportCmd = New IMANEXTLib.ImportCmd
objImportCmd.Initialize(objContextItems)
objImportCmd.Update()
If objImportCmd.Status = IMANEXTLib.CommandStatus.nrActiveCommand Then
'Imports the document, throwing a Save As screen at the user
objImportCmd.Execute()
И в этот момент я получаю новый экземпляр Word поверх того, из которого я сохраняю (то есть поверх Application). Что дает?