FileSaveCmd/Dlh Incorrect Parameter
Hi
I'm trying to invoke the FileSaveCmd/Dlg on creation of a new document. In a nutshell, we have 3rd party code which populates profile information and sets other values, such as default location, etc, etc so that when a new document is created the user does not have to physically save it - everything is done for the user.
This code has been added to the the OnInitDialog event of the iManFileSaveCmd, but when I apply the Execute command, I get an error telling:
iManExt2: Unable to save the File
iManExt2 The Parameter is incorrect
followed by
AltUnAdvise Failed
iManExt Error 0x80040200
Then
AltUnAdvise Failed
iManExt2 The Parameter is incorrect
The problem is, I have no idea which parameter it is. If I do not invoke the FileSaveCmd.Execute action and therefore press Save on the displayed dialog instead, the file saves perfectly well yet when invoked through code this error appears. I have even iterated through the context items on the OnPostOK event and set any of these that I can in the OnInitDialog event, but to no avail.
Any help would be much appreciated.
Below is an example of the code which runs OnInitDialog
Private Sub objIManFileSaveCmdSink_OnInitDialog(ByVal pMyInterface As Object)
Set objiManFileSaveDlgSink = pMyInterface
Dim clsi10 As i10Connect.clsi10Connect
Dim tmpDMS As IManage.ManDMS
Dim tmpNRTDatabase As IManage.NRTDatabase
Set tmpDMS = objExtensibilitySink.Context("NRTDMS")
Set tmpNRTDatabase = tmpDMS.Sessions.ItemByIndex(1).Databases.ItemByIndex(1)
Dim pClientNo As String <-- imProfileCustom1
Dim pMatterNo As String <-- imProfileCustom2
pClientNo = "TESTCLIENT"
pMatterNo = "TESTMATTER"
Set clsi10 = New i10Connect.clsi10Connect <-- 3rd party DLL to return a workspace object based on pClientNo and pMatterNo above
Dim tmpManWorkSpace As IManage.IManWorkspace
Set tmpManWorkSpace = clsi10.clsgetworkspace(tmpDMS, tmpNRTDatabase, pClientNo, pMatterNo)
Dim tmpManFolder As IManage.IManFolder
Set tmpManFolder = clsi10.clsGetFolder(tmpManWorkSpace, "correspondence") <-- Returns folder object from workspace
Dim tmpDefLoc As String
tmpDefLoc = clsi10.clsSetFolderDestination(tmpDMS, Nothing, tmpManFolder, 2) <-- Returns string used to specify default location
Dim tmpContextItems As New IMANEXTLib.ContextItems
With tmpContextItems
.Add "ParentWindow", 0
.Add "IManExt.AppMode", 1
.Add "IManExt.SaveAsOptionCmd.SaveAsTypesIndex", 0
.Add "IManExt.SaveAsOptionCmd.SaveAsTypeString", "Word Document"
.Add "IManExt.DocOpenLocation", vDefLoc
.Add "IManExt.OpenCmd.NoCmdUI", True
End With
objImanFileSaveCmdSink.Initialize tmpContextItems
objImanFileSaveCmdSink.Update
With objiManFileSaveDlgSink
.UsePreferredDatabase = False
.CloseOnOK = False
.DestinationObject = tmpDMS
.Sessions = tmpDMS.Sessions
.DefaultLocation = tmpDefLoc
.SetAttributeValueByID imProfileDescription, "Test document", True
.DocType = "WORDX"
.SetAttributeValueByID imProfileClass, "DOC", True
.SetAttributeValueByID imProfileAuthor, CStr(tmpDMS.Sessions.ItemByIndex(1).UserId), True
.SetAttributeValueByID imProfileOperator, CStr(tmpDMS.Sessions.ItemByIndex(1).UserId), True
.SetAttributeValueByID imProfileCustom1, pClientNo, True
.SetAttributeValueByID imProfileCustom2, pMatterNo, True
.SetAttributeValueByID imProfileType, "WORDX", True
.SetAttributeValueByID imProfileCustom22, Now, True
.SetAttributeValueByID imProfileCustom25, False, True
.SetAttributeValueByID imProfileCustom26, False, True
.SetAttributeValueByID imProfileCustom27, False, True
.SetAttributeValueByID imProfileCustom28, False, True
End With
objImanFileSaveCmdSink.Update
objImanFileSaveCmdSink.Execute
End Sub