Document remains checked out when saving documents via VBA with SP3 U5
Hi
Having recently upgraded to Worksite 8.5 SP3 U5, I have noticed a strange issue where if the document has been created in the system via VBA coding, when I eventually close the document, it remains checked out.
Here's a summary of what the code does:
1) Create a temporary file (temp_file.docx) on the local drive.
2) Create a new NRTDocument to save onto the system and check this in using the temporary file.
3) Check out the NRTDocument to the NRPortbl\Worksite\ directory.
4) Save the ActiveDocument as the checked out path of the NRTDocument.
5) Release the NRTDocument object from memory
6) Use standard Word 2010/Worksite integration save and close routines to update the document.
Using the same code for SP2 U6 (bar changing the objects to use iManO2k reference), the error does not arise. Am I missing something?
Here is the coding in it's most basic form and if anyone can shed light on where I'm going wrong I'd be really grateful.
Thanks
Dim fso As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Dim t_objCOMAddin As Office.COMAddIn
Dim t_myExtObject As WorkSiteAddinInterfaces.iManageExtensibility
Dim t_NRTDocument As IManage.NRTDocument
Dim t_iManDMS As IManage.ManDMS
Set t_objCOMAddin = Application.COMAddIns("WorksiteOffice2007Addins.Connect")
Set t_myExtObject = t_objCOMAddin.Object
Set t_iManDMS = t_myExtObject.Context("NRTDMS")
Dim t_pSessions As IManage.NRTSessions
Set t_pSessions = t_iManDMS.Sessions
Dim t_iManDatabase As IManage.IManDatabase
Set t_iManDatabase = t_pSessions(1).Databases("WORKSITE")
Dim t_strPath As String
t_strPath = "c:\nrportbl\worksite\jjsmith"
Dim t_objTempFile As Object
Set t_objTempFile = fso.createtextfile(t_strPath & "\temp_file.docx")
t_objTempFile.writeline Format(Now, "dd-mm-yyyy hh:mm:ss")
t_objTempFile.Close
Set t_objTempFile = Nothing
Set t_NRTDocument = t_iManDatabase.CreateDocument
t_NRTDocument.SetAttributeValueByID nrAuthor, "JJSMITH"
t_NRTDocument.SetAttributeValueByID nrClass, "DOC"
t_NRTDocument.SetAttributeValueByID nrCustom1, "USERS"
t_NRTDocument.SetAttributeValueByID nrCustom2, "JJSMITH"
t_NRTDocument.SetAttributeValueByID nrType, "WORDX"
t_NRTDocument.SetAttributeValueByID nrDescription, "Holding Document"
t_NRTDocument.SetAttributeValueByID nrOperator, "JJSMITH"
Dim t_objErrs As Object
t_NRTDocument.CheckIn t_strPath & "\temp_file.docx", nrNewDocument, nrDontKeepCheckedOut, t_objErrs
fso.deletefile (t_strPath & "\temp_file.docx")
t_NRTDocument.CheckOut t_strPath & "\" & t_NRTDocument.Number & "_" & t_NRTDocument.Version & "." & t_NRTDocument.Extension, nrReplaceExistingFile, Now, ""
ActiveDocument.SaveAs t_NRTDocument.CheckoutPath
ActiveDocument.Save
t_NRTDocument.SetAttributeValueByID nrDescription, "Test for saving in Word"
t_NRTDocument.UpdateProfile t_objErrs
Set t_NRTDocument = Nothing
Having recently upgraded to Worksite 8.5 SP3 U5, I have noticed a strange issue where if the document has been created in the system via VBA coding, when I eventually close the document, it remains checked out.
Here's a summary of what the code does:
1) Create a temporary file (temp_file.docx) on the local drive.
2) Create a new NRTDocument to save onto the system and check this in using the temporary file.
3) Check out the NRTDocument to the NRPortbl\Worksite\ directory.
4) Save the ActiveDocument as the checked out path of the NRTDocument.
5) Release the NRTDocument object from memory
6) Use standard Word 2010/Worksite integration save and close routines to update the document.
Using the same code for SP2 U6 (bar changing the objects to use iManO2k reference), the error does not arise. Am I missing something?
Here is the coding in it's most basic form and if anyone can shed light on where I'm going wrong I'd be really grateful.
Thanks
Dim fso As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Dim t_objCOMAddin As Office.COMAddIn
Dim t_myExtObject As WorkSiteAddinInterfaces.iManageExtensibility
Dim t_NRTDocument As IManage.NRTDocument
Dim t_iManDMS As IManage.ManDMS
Set t_objCOMAddin = Application.COMAddIns("WorksiteOffice2007Addins.Connect")
Set t_myExtObject = t_objCOMAddin.Object
Set t_iManDMS = t_myExtObject.Context("NRTDMS")
Dim t_pSessions As IManage.NRTSessions
Set t_pSessions = t_iManDMS.Sessions
Dim t_iManDatabase As IManage.IManDatabase
Set t_iManDatabase = t_pSessions(1).Databases("WORKSITE")
Dim t_strPath As String
t_strPath = "c:\nrportbl\worksite\jjsmith"
Dim t_objTempFile As Object
Set t_objTempFile = fso.createtextfile(t_strPath & "\temp_file.docx")
t_objTempFile.writeline Format(Now, "dd-mm-yyyy hh:mm:ss")
t_objTempFile.Close
Set t_objTempFile = Nothing
Set t_NRTDocument = t_iManDatabase.CreateDocument
t_NRTDocument.SetAttributeValueByID nrAuthor, "JJSMITH"
t_NRTDocument.SetAttributeValueByID nrClass, "DOC"
t_NRTDocument.SetAttributeValueByID nrCustom1, "USERS"
t_NRTDocument.SetAttributeValueByID nrCustom2, "JJSMITH"
t_NRTDocument.SetAttributeValueByID nrType, "WORDX"
t_NRTDocument.SetAttributeValueByID nrDescription, "Holding Document"
t_NRTDocument.SetAttributeValueByID nrOperator, "JJSMITH"
Dim t_objErrs As Object
t_NRTDocument.CheckIn t_strPath & "\temp_file.docx", nrNewDocument, nrDontKeepCheckedOut, t_objErrs
fso.deletefile (t_strPath & "\temp_file.docx")
t_NRTDocument.CheckOut t_strPath & "\" & t_NRTDocument.Number & "_" & t_NRTDocument.Version & "." & t_NRTDocument.Extension, nrReplaceExistingFile, Now, ""
ActiveDocument.SaveAs t_NRTDocument.CheckoutPath
ActiveDocument.Save
t_NRTDocument.SetAttributeValueByID nrDescription, "Test for saving in Word"
t_NRTDocument.UpdateProfile t_objErrs
Set t_NRTDocument = Nothing
0
Categories
- All Categories
- 107 Developer Announcements
- 53 Articles
- 105 General Questions
- 141 IM Services
- 43 OpenText Hackathon
- 32 Developer Tools
- 20.6K Analytics
- 4.1K AppWorks
- 8.9K Extended ECM
- 898 Cloud Fax and Notifications
- 76 Digital Asset Management
- 9.3K Documentum
- 29 eDOCS
- 118 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management
TeamSite Developer Resources
If you are interested in gaining full access to the content, you can register for a My Support account here.
- Docker Automation
- LiveSite Content Services (LSCS) REST API
- Single Page Application (SPA) Modules
- TeamSite Add-ons
If you are interested in gaining full access to the content, you can register for a My Support account here.