Home
TeamSite
Adding a Word Document to the Database using vb.net
IestynJ
I'm trying to upload a word document from a local machine into the Worksite database and add it to a workspace using the SDK and com objects in Visual Studio
So far i've got the following:
********************************************************
'these are initialized on loading my app
Public worker As IManWorkArea
Public mySession As IManSession
Public myDMS As IManDMS
Dim db = mySession.PreferredDatabase
Dim newDoc = db.CreateDocument
Dim user = db.GetUser(mySession.UserID)
Dim docClass As IManDocumentClass
Dim docType As IManDocumentType
Dim errors As Object
With newDoc
.Name = "Test Document"
.Author = user
.Operator = user
.Type = ???
.Class = ???
End With
newDoc.CheckIn("C:\test.doc", imCheckinDisposition.imCheckinNewDocument, imCheckinOptions.imDontKeepCheckedOut, errors)
*******************************************************
I know i need to set docType, docClass as a minimum to save the document but i'm not sure where to get these references or if i'm even on the right track.
Find more posts tagged with
Comments
colettem
Hi.
I've only got the C# code for getting the DocType and Class but it should put you on the right track.
IManDocumentType imDocType = db.SearchDocumentTypes("documentType", imSearchAttributeType.imSearchBoth, true).Item(1);
IManDocumentClass imDocClass = db.SearchDocumentClasses("documentClass", imSearchAttributeType.imSearchBoth, true).ItemByIndex(1);
Migrateduser
WorkSite can autodetect the type based on the type of file. Class is listed in the WorkSite database, and is always required. Based on the class and potentially subclass, additional fields will be required. The error collection will tell you what is missing.