Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Can't checkin new document using iManage COM API
masterofimages
I'm having problems checking in a new document using the iManage (COM) API. Following the sample code in the SDK documentation, I can create a new document just fine. Then I set the required profile fields (again, no problems), but when I try to set the required custom attributes I get the following error:
System.Runtime.InteropServices.COMException : [CollectionData ][Item ]Item "28" does not exist in collection
at IManage.NRTCustomAttributesClass.Item(Object Index)
Attribute 28 (IManage.AttributeID.nrCustom4) is the first of 2 required attributes in the RequiredFields collection of the document class. Any attempt to check-in the document without setting the required attributes results in the following error:
System.Runtime.InteropServices.COMException : [NRTDocument ][Checkin ]Importing new document into database : Document profile is invalid
Here is a sample of the code I am using:
' Create new iManage document and set required profile attributes
Dim newDocument As INRTDocument = document.Database.CreateDocument()
With newDocument
' Set new document security and document type to match source document
.Security.DefaultSecurity() = document.Security.DefaultSecurity
For Each acl As NRTGroupACL In document.Security.GroupACLs
.Security.GroupACLs.Add(acl.Group.Name, acl.Right)
Next
For Each acl As NRTUserACL In document.Security.UserACLs
.Security.GroupACLs.Add(acl.User.Name, acl.Right)
Next
.Author = document.Author
.Class = document.Class
.Description = description ' Use supplied description
.Operator = GetCurrentUser(.Database)
.Type = document.Type
' Set required custom attributes
For Each attribute As AttributeID In .Class.RequiredFields
.SetAttributeValueByID(attribute, document.CustomAttributes.Item(attribute)) ' <--- First exception occurs here
Next
End With
' Get a copy of the source document and check this in as the new document
document.GetCopy(checkoutLocation, GetCopyOptions.nrNativeFormat)
Dim profileErrors As Object = Nothing
newDocument.CheckIn(checkoutLocation, CheckinDisposition.nrNewDocument, CheckinOptions.nrDontKeepCheckedOut, profileErrors) ' <--- Second exception occurs here (if line of first exception commented out)
The above code is VB.NET (2005), using a generated iManage Interop assembly to access the iManage COM dll (version 7.5.0.115).
I appreciate any help on this.
Thanks,
Paul
Find more posts tagged with
Comments
There are no comments yet