Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
ImportNewVersionCmd
bfelknor
Is there any documentation for using the IManExtLib.ImportNewVersionCmd ?
I have found an example called "Import New Version" that actually checks out the current version of a doc, swaps the old file for the new on the local drive, then does a checkin using a new version parameter.
Ok. But isn't this what the ImportNewVersionCmd (at least it sounds like it !) should do ?
Thanks.
Bruce
Find more posts tagged with
Comments
jny
Yes, you may use the ImportNewVersionCmd instead.
bfelknor
Yes, but is there an example ?
jny
Here's a VB6 code example:
Option Explicit
Private Sub Form_Load()
On Error GoTo Oops
Dim dms As New ManDMS
Dim sess As IManSession
Dim oSourcedoc As IManDocument
Dim oNewVer As IManDocument
Dim arrDox(0) As NRTDocument
Dim ps As IManProfileSearchParameters
Dim ofl
Dim oCmd As ImportNewVersionCmd
Dim oContext As ContextItems
Dim bRefresh
Set sess = dms.Sessions.Add("SERVERNAME")
sess.TrustedLogin
Set ps = dms.CreateProfileSearchParameters
ps.Add imProfileAuthor, sess.UserID
ps.Add imProfileCheckedOut, "N"
' One way to get a document object
Set oSourcedoc = sess.PreferredDatabase.GetDocument(12, 1).LatestVersion ' Arbitrary example of a document number
Set arrDox(0) = oSourcedoc
Set oCmd = New ImportNewVersionCmd
Set oContext = New ContextItems
' Required
oContext.Add "SelectedNRTDocuments", arrDox
oContext.Add "ParentWindow", Me.hWnd
oContext.Add "DestinationObject", sess
'Optional
'oContext.Add "IManExt.Import.DeleteLocalFiles", True
oContext.Add "IManExt.Import.FileName", "C:\Temp\Dummy Docs\testme.doc"
oContext.Add "iManExt.NewVersionCmd.NoCmdUI", True
' Skips the NewVersion Profile dialog
oCmd.Initialize oContext
oCmd.Update
If oCmd.Status = (oCmd.Status And nrActiveCommand) Then
oCmd.Execute
bRefresh = oContext.Item("IManExt.Refresh")
Set oNewVer = oContext.Item("IManExt.NewversionCmd.Document")
End If
GoTo Cleanup
Oops:
MsgBox Err.Description
Err.Clear
Resume Next
Cleanup:
Set ps = Nothing
Set oSourcedoc = Nothing
Set sess = Nothing
Set dms = Nothing
End
End Sub
xmlDSReport.JPG
kaumil
Hi Jny
The Above code looks alright but i can't seem to get the return document or the imported document when i try to refer to it in the context items collection
e.g.
Set oDoc = mContext.Item("IManExt.NewVersionCmd.Document")
and also whether it should be
mContext.Item("IManExt.ImportNewVersionCmd.Document")
as the Import new version command is being used !!
what could be wrong ?? as my document imports as the new version but i need to update its profile before i loose the pointer to the new document.
thanks in advance,
kaumil
jny
I tested the code before posting it. The IManExt.NewVersionCmd.Document ContextItem, which is case-insensitive, returns the new version successfully in my testing.
kaumil
Hi Jny,
My apologies as i wasnt assigning to the right object type !! the code works fine. Once again thanks for getting back so promptly.
Thats Excellent.
regards,
Kaumil