Home
TeamSite
Worksite Web
shahbm
Hello Tech Gurus,...
I m new to develop web apps to integrate with iManage,
and here is what i m trying to do.. "I m trying to import a word document into Desksite (8.2)..."
what i m trying to achieve is quite easy with windows app, .. and infact the ready made code is available on tech library both in vb and vb.net
- the purpose of going for web app is bcos our clients wanted to import documents from their home..
I've created a web app with the code copied from the windows app, and its working till i execute the command!!
--------------------------------------------------------------------
Public WithEvents oCmd As IMANEXTLib.ImportCmd
Private WithEvents oDlg As IMANEXTLib.NewProfileDlg
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Private Const SERVER_NAME As String = "IMAN_SERVER"
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim oContext As IMANEXTLib.ContextItems
Dim oNewDoc As IManage.NRTDocument
Dim oDMS As New IManage.NRTDMS
Dim oSess As IManage.NRTSession
Dim sPath As String
Dim i As Integer
On Error GoTo ERROR_HANDLER
' Login
'On Error Resume Next
oSess = oDMS.Sessions.Add(SERVER_NAME)
'oSess.TrustedLogin()
oSess.Login("USERID", "PASS")
If oSess.Connected = True Then
Label1.Text = "Connected to the DMS Server..."
Else
Label1.Text = "Unable to Log in to the server"
Exit Sub
End If
' Change importing document path here
sPath = "c:\temp\tem.doc"
If CreatePopulatedFile(sPath) = False Then Exit Sub
oContext = New IMANEXTLib.ContextItems
Dim myhandle As Long
' Required values
oContext.Add("DestinationObject", oSess.PreferredDatabase)
Label1.Text = "Connected to DMS"
-------------NOT SURE HOW TO GET THE HANDLE LIKE IN WINDOWS APP---
oContext.Add("ParentWindow", myhandle) ' Me.Handle.ToInt32)
-------------------------------------------------------------------------
' Optional values
oContext.Add("IManExt.Import.FileName", sPath)
oContext.Add("IManExt.Import.DocDescription", "Testing preprofiling.")
oContext.Add("IManExt.Import.DocAuthor", oSess.UserID)
oContext.Add("IManExt.Import.DocType", "word")
oContext.Add("IManExt.Import.DocClass", "doc")
oCmd = New IMANEXTLib.ImportCmd
oCmd.Initialize(oContext)
oCmd.Update()
-----------------PROBLEM HERE-----------------------------------
oCmd.Execute()
------------------------------------------------------------------
On Error Resume Next
oNewDoc = oContext.Item("ImportedDocument")
Label1.Text = ("Document is imported, DOCNUM: " & oNewDoc.Number & "_" & oNewDoc.Version)
GoTo Cleanup
ERROR_HANDLER:
Response.Write(Err.Description)
Err.Clear()
Cleanup:
' Logout and close app
If Not oSess Is Nothing Then
If oSess.Connected Then
oSess.Logout()
oDMS.CloseApplication()
End If
End If
' Free pointers
oContext = Nothing
oCmd = Nothing
oNewDoc = Nothing
oSess = Nothing
oDMS = Nothing
End Sub
Private Sub oCmd_OnInitDialog(ByVal pMyInterface As Object) Handles oCmd.OnInitDialog
On Error Resume Next
oDlg = pMyInterface
'change nrCustom1 here
oDlg.SetAttributeValueByID(IManage.AttributeID.nrCustom1, "CLIENT", True)
'change nrCustom2 here
oDlg.SetAttributeValueByID(IManage.AttributeID.nrCustom2, "MATTER", True)
End Sub
Private Function CreatePopulatedFile(ByRef sFil As String) As Boolean
On Error Resume Next
CreatePopulatedFile = False
Dim fso As New Scripting.FileSystemObject
Dim fil As Scripting.TextStream
Dim strFil As String
strFil = fso.BuildPath(fso.GetSpecialFolder(2).Path, fso.GetTempName)
strFil = Replace(strFil, "tmp", "DOC")
fil = fso.CreateTextFile(strFil, True)
'fil.Write("testing importing a new Word doc...")
fil.Close()
sFil = fso.GetFile(strFil).Path
If sFil <> "" Then CreatePopulatedFile = True
End Function
-------------------------------------------------------------------------
ANYONE THERE TO HELP ME OUT..!!
Find more posts tagged with
Comments
There are no comments yet