Posted Thu, 31 Dec 2020 10:12:43 GMT by John Campbell-Higgens
I am trying to programmatically get a list of Field in a File Cabinet (or Basket/Document Tray) when I user selects a Cabinet.  Looking at the code schema there is the FileCabinetFields which I should be able to obtain from the FileCabinet.Fields, but when I do this I get a count of 0 and no fields, I am using the wrong thing to get a list of fields available in the cabinet?

Here is the VB.Net code:

docuWareConnection = ServiceConnection.Create(uri, userName, userPassword, organization:=organisation)
        docuWareOrg = docuWareConnection.Organizations(0)

        fileCabinets = docuWareOrg.GetFileCabinetsFromFilecabinetsRelation().FileCabinet

        For Each fc In fileCabinets
            If String.Compare(fc.Name, cabinet, True) = 0 Then
                fieldList = fc.Name + "|" + fc.Fields.Count.ToString
                fileCabinetFields = fc.Fields
                For Each fileCabinetField In fileCabinetFields
                    fieldNameDB = fileCabinetField.DBFieldName
                    fieldNameDisplay = fileCabinetField.DisplayName
                    fieldNameType = fileCabinetField.DWFieldType
                    fieldList = fieldList + fieldNameDB + "|" + fieldNameDisplay + "|" + fieldNameType + "||"
            End If


Thanks for any input.
Posted Sat, 02 Jan 2021 10:27:30 GMT by Fabian Kall
The thing with the .Net Api is, that whenever you're dealing with one of the entities of the DocuWare System (FileCabinets, DocumentIndexFields, Documents, etc...) in Your code, You may or may not have the full entity.

In Your case, You are asking the organization for it's FileCabinets, and then each FileCabinet for it's Fields. The FileCabinet instance you have in Your inner ForEach loop is not the full entity, and it's Fields property (and other properties) have not been filled. That's why You're getting a field Count of 0.

In order to make sure that You have the full entity of the FileCabinet, call the GetFileCabinetFromSelfRelation() Method on the FileCabinet itself.
So I guess your first statement in the if-clause should be something like:

fc = fc.GetFileCabinetFromSelfRelation()

Although I'm not sure about VB Syntax. After that, the Fields property should hold all IndexFields. 
BeWare that it will also hold the IndexFields ceated by the System, like DWDOCID, DWEXTENSION, etc. You can filter the Fields for their "Scope" property in order to get only the Fields that are explicitly created in the configuration.

Posted Thu, 07 Jan 2021 16:39:10 GMT by Tobias Getz DocuWare GmbH Director Product
Also keep in mind, that document trays do not have fields by themselfs, they just have all fields, the documents in them have. So you cannot ask DocuWare which fields are available in a document tray.
Tobias Getz

You must be signed in to post in this forum.