Hummingbird Enterprise™ 2004, DM, and RM are trademarks of Hummingbird Ltd. and/or its
subsidiaries. All other copyrights, trademarks, and trade names are the property of their respective
owners.
Your enclosed license agreement with Hummingbird Ltd. or one of its affiliates specifies the
permitted and prohibit ed uses of the pr oduct. A n y unau thorized d uplicatio n or use o f the pr od uct in
whole or part is strictly forbidden. No part of this document may be copied, reproduced, translated,
or transmitted in any form or by any means without the prior written consent of Hummingbird Ltd.
RESTRICTED RIGHTS LEGEND. Unpublished rights reserved under the copyright laws of the
United States and any other appropriate countries. The SOFTWARE is provided with restricted
rights. Use, duplications, or disclosure by the U.S. Government is subject to restriction as set forth in
subparagraph (c) of The Rights in Technical Data and Computer Software clause at DFARS 252.2277013, and subparagraph (c)(1) of the Commercial Computer Software-Restricted Rights clause at 48
CFR 52.227-19, as applicable, similar clauses in the FAR and NASA FAR Supplement, any successor
or similar regulation.
The information contained in this document is subject to change without notice. If this document is
provided in both printed and electronic form, the electronic form will govern in the event of any
inconsistency. Information in this document is subject to change without notice and does not
represent a commitme nt on th e part of Hummingbird Ltd. Not all copyrights pertain to all products.
DISCLAIMER. Hummingbird Ltd. software and documentation have been tested and reviewed.
Nevertheless, Hummingbird Ltd. makes no warranty or representation, either express or implied,
with respect to the software and documentation included. In no event will Hummingbird Ltd. be
liable for direct, indirect, special, incidental, or consequential damages resulting from any defect in
the software or documentation included with these products. In particular, Hummingbird Ltd. shall
have no liability for any programs or data used with these products, including the cost of recovering
such programs or data.
About This Guide xv
Who Should Read This Guide xv
How This Guide Is Organized xv
Documentation Conventions xvi
Related Documentation xvi
Professional Services xvii
Where to Go for Information xviii
On the Web xviii
On the DM Suite CD xviii
Technical Support and Training xix
North America Technical Support xix
Asia/Pacific Technical Support xix
Europe Technical Support xix
Training xx
Chapter 1The DM Architecture
The DM Multi-Tier Architecture 2
DM Functionality 2
Document Security Tokens 4
Transactions 4
DM Object Model 4
DM Objects 4
DM Forms 5
Types of DM Objects 5
Defining a DM Object 6
DM Support Objects 6
DM Query Objects 7
Document Objects 7
iii
Child Objects of PCDDocObject Objects 7
The Logon Process 7
Getting a List of Available Libraries 8
Providing Library Access 9
DM Search Transactions 11
General Steps to Performing a Search 12
Retrieving Recently Edited Documents 13
Performing a Simple Search 16
Document Objects 19
Fetching a DM Document Object 19
Getting and Updating Trustee Information 23
Chapter 2An Overview of the DM API
The PCDClient Object 30
List of DM API Objects 30
Early and Late Binding 31
Early Binding 31
Late Binding 31
Methods and Properties Supported by DM API Objects 32
Tokens Supported by DM API Methods and Properties 41
This guide describes the application programming interface (API) that
is available as part of DM. It identifies each of the objects comprising
the API and discusses the methods and properties that each object
supports.
Who Should Read This Guide
Users who extend DM functionality by creating their own custom
enhancements will use the DM API Reference Guide to show them how
their extensions can operate seamlessly with the base product. This will
also be the case for software developers who create their own software
products for specialized applications that address unique user needs
that are not addressed by DM.
Preface
How This Guide Is Organized
This book has four chapters.
•Chapter 1: The DM Architecture—This chapt er describes how the
API and other components of DM work together.
•Chapter 2: An Overview of the DM API—This chapter describes
the overall structure of DM.
•Chapter 3: DM API Objects —This chapter describes the objects
in the API and lists the methods and properties that each supports.
•Chapter 4: DM API Methods and Properties —This chapter
describes each of the methods and properties that are supported
by DM API objects.
•Chapter 5: DM API Tokens —This chapter describes each of the
tokens that are supported by DM API methods.
xv
Documentation Conventions
This book uses the following fonts and styles to indicate different types
of information.
ConventionMeaning
Italic
Monospaced font Indicates a file, directory, drive or command
Bold
>Separates items on more than one
Cross-referenceClick on these links to be taken to related
Related Documentation
In addition to this manual, you may find the following documents
helpful.
Indicates a new term or variable in a
command line. For example, replace
filename with the name of a file.
name, program code, or other text that
appears on the computer screen. For
example, the default library for DM is usually
c:\Program Files\ Hummingbird\D M
Server
In instruction steps, indicates information you
must type. In text, indicates emphasis.
cascading menu or successive choices of
icons or program groups.
information in the document.
.
xvi CHAPTER 3
•DM/RM Data Dictionary - Describes the tables and columns that
comprise the DM/RM SQL database.
•DM Designer Guide - Provides detailed instructions on how you
can use the Designer component of DM to create and maintain
forms used by your DM installation. I t also describes how y ou can
use Designer to customize the tables and columns that comprise
the SQL database that DM uses to manage your Hummingbird
environment.
Professional Services
Hummingbird’s Professional Services’ consultants and educators
successfully design, create, and implement powerful integrated
solutions based on Hummingbird technology. They are dedicated to
forging sustainable, long-term relationships with our clients and
partners by delivering superior consulting, training, and education
solutions.
Professional Services' engagements include all aspects of the system
implementation life cycle, specifically:
•project management
•planning and process analysis
•requirements definition
•software installation and prototyping
•custom code development
•code reviews and walkthroughs
•integration with non-Hummingbird technology
•benchmarking
•data conversion and migration
•documentation knowledge transfer
Our consultants are available to help you build or enhanc e application
components, high-level APIs, user interfaces and system
administration utilities for Windows clients, Web clients, and serverside applications using various development environments.
If you are implementing enterprise portals, document and knowledge
management, data integration and reporting, or ETL, Hummingbird
Professional Services can help guide you to success. To find out more
about Professional Services visit our Web site at http://
www.hummingbird.com/solutions/services or send an e-mail to
getinfo@hummingbird.com.
xvii
Where to Go for Information
On the WebOur Web site at www.hummingbird.com/support/dkm/ carries the
most up-to-date information about Hummingbird’s document and
knowledge management products. This information is presented in
individual technical bulletins and in Knowledge Base Solutions, each
dealing with a specific topic that is not covered in our manuals or that
updates information in the manuals. Before installing or upgrading
DM, we suggest you browse through the bulletins or search the
Knowledge Base for items that may be pertinent to your installation.
For WebSupport, you will be asked to enter your user name and
password for authentication. If you have not registered for a
WebSupport account, you can do so at www.hummingbird.com/
support/dkm/registration.html.
On the DM Suite
CD
In addition to software, the DM Suite CD houses important
documentation and ancillary files to assist you install and use DM.
Release Notes
The DM Release Notes for the current version reside in the
…\Documentation\Readme
contain information that came to light after the documentation was
printed. Hyperlinks to known bugs and workarounds ar e also listed in
the Release Notes.
folder on the CD. The release notes
Installing Acrobat Reader
The DM product line’s online manuals, which are published in PDF
format, are provided on the DM Suite CD . To r ead these manuals, you
will need a copy of Ad obe Acr obat Reade r installed on your machine . A
setup program for Acrobat Reader 5.0 is provided on the DM CD. If
you do not already have a copy, follow the instructions below.
1Insert the DM Suite CD into your computer’s CD-ROM drive.
2The DM product line installation menu will be displayed. Click
Documentation.
xviii CHAPTER 3
3Click Install Acrobat Reader. The Acrobat Reader version 5.0
install program will launch.
4Follow the on-screen instructions and install the program. When
complete, exit the DM Product Line Installation menu.
To access the entire DM do cumentation set:
1Insert the DM Suite CD into your computer’s CD-ROM drive.
2The DM Product Line Installation menu will be displayed. Click
Documentation.
3Select Browse Documentation. Double-click the Online
Manuals
4Double-click HummingbirdDMBooks.html. Your Internet
browser will launch and a menu listing the DM documentation
set will appear.
Level 12
80 Mount Street
North Sydney, NSW 2060, Australia
Telephone: 61 2 9923 2011
Fax: 61 2 9922 3097
E-Mail:supportsyd@hummingbird.com
20 rue Thérèse
75001 Paris, France
Telephone:33 1 55 35 96 80
Fax:33 1 42 61 31 87
E-Mail:support.eu.kmdm@hummingbird.com
800 486 0095 from 8:00 A.M. to 8:00 P.M. ET
xix
TrainingHummingbird’s Education Services offers courses at authorized
training centers worldwide. For more information or to register for
classes, contact Hummingbird Education Services:
Telephone:613 238 1761
E-Mail:education@hummingbird.com
Internet Address:www.hummingbird.com/education
xx CHAPTER 3
Chapter
1
The DM Architecture
In This Chapter
This chapter provides an overview of the DM functionality, ill ustrating
how the major components of DM are designed to work with one
another. C ode samples illustrate how custom applications can perform
many basic operations, such as allowing user access and performing
searches.
THE DM ARCHITECTURE 1
The DM Multi-Tier Architecture
The DM Multi-Tier Architecture
DM is an application that runs on Window s NT/2000/XT P ro systems.
As shown in the illustration below, the DM API provides a basic set of
operations that interface with the DM Server. Client applications—
whether the DM Webtop, any of the DM Extensions, or custom
software you might develop—extend the DM API by providing a user
interface and any other functionality appropriate to the new
application.
DM Functionality
The diagram below illustrates how multiple clients can connect to a
single DM Server and how a DM Server can connect to multiple DM
repositories. A DM repository is comprised of the Document File Store,
the SQL database, and the full-text indexer.
2 CHAPTER 1
DM Functionality
The DM Server is a transaction server, similar to Microsoft SQL Server .
The DM Server manages database connections via a connection pool.
A client application connects to the DM Server via DCOM (Distributed
Component Object Model) interfaces that are typically free threaded.
The DM executable file (DOCSFusion.EXE) loads COM objects
configured in the registry. Once connected, users can connect to any
repositories to which they have access rights.
DM is stateless, so the client does not remain connected to the DM
Server. A client application submits a transaction using a document
security token (DST), and DM then determines the validity of the DST.
If the DST is valid, the DM Server processes the transaction and returns
the results to the client software. No state information is kept by the
DM Server about the client.
Note: DM enforces document security rights. Users cannot access objects (for
example, documents or folders) to which they do not have rig hts.
In DM, library maintenance tasks such as archiving and full-text
indexing occur in the background, and the re is no nati ve user inte rface
(UI). (T o simplify these diagrams, DM Index er Servers are not shown.)
Developers must create user interfaces to connect to the DM Server.
THE DM ARCHITECTURE3
Document Security
Tokens
TransactionsWith DM, multiple libraries can be configured for each server to
A document security token (DST) is initially constructed by DM
when a user logs on via a client application to the server and is
required for DM transactions. The DST can be used across multiple
DM Servers—when the user logs on to other DM Servers to access
other Document libraries, the server information is appended to the
DST—or the client application can use multiple DSTs.
manage, and transactions can occur on these specified libraries. The
libraries available to a DM Server are configured via the DM Server
Manager program and the PCDOCS.INI file. The client application
must handle multiple library access and take into account issues s uch
as that of incompatible forms.
Caution: You have direct access to the SQL database, allowing yo to
implement many operations directly by use of the computer langu age you
use for your application. For example, specialized terms you implement can
be managed by accessing the TERMINOLOGY table in the SQL database.
It is recommended that you do not use this capa bility. Using the appropriate
DM API objects and methods will insure that the correct security controls are
enforced and that other internal database relationship s are main tained.
DM Object Model
DM provides the following document management services:
•Search for documents stored in DM file stores.
•Create, delete, and update document profiles.
•Modify security on profiles and folders.
•Upload files to and download files from DM file stores.
DM ObjectsDM objects are low-level and general objects that presuppose a
knowledge of how the DM environment operates (for example, how
security rights are enforced). It is also important for DM API users to
have a thorough understanding of both client and server software, as
well as how they interact.
Types of DM Objects
The DM Object Model consists of Distributed Component Object
Model (DCOM) objects that are exposed via DM. Operations on DM
objects map to operations on tables and typically require several
properties to be set to define the objects. The object properties after
instantiation may differ depending on how the object was created.
When building a DM client application, you will use the PCDClient
type library (pcdclient.dll) and development tools such as C++, Visual
Basic, Java, or Active Server Pages.
Note: Examples in this document show sample code w ritten in Visual Basic.
Similarly, this document refers to API items using Visual Basic nomenclature in
preference to terminology more common to C++, Java, or other progra mming
language environments. For example, the term “o bject” is generally used in
preference to “class” or “interface.” Also, “method” is used in place of
“function,” and “property” is used in place of “attribute.”
DM FormsDM forms include those used as profile forms, query-by-example and
other search forms, results lists, and lookups. These forms are fully
customizable using DM Designer. Using DM Designer, you can also
create your own forms.
With DM, forms are an abstraction layer for the SQL database that
allows your applications to access the library database. DM supports
Search, Query, Lookup, and Profile forms. DM uses a form definition
to mediate client requests for data and r ead/write access to the database.
The form definition maps the name of a field in the form to a SQL
column in the database. Most client appli cation calls are done using the
name of the field as shown on the form, rather than the name of the
column in the SQL database. DM uses the SQL_INFO call, which is
embedded in the form definition that resides in the SQL database. Each
form must specify a primary table in the database as part of its form
definition.
Types of DM Objects
The DM API defines several types of objects:
•Support (read only), which facilitates the log on process.
THE DM ARCHITECTURE 5
Types of DM Objects
•Query (read only), which is used for search, Quick Retrieve, and
lookups.
•PCDDocObject (read/write), which implements the DM objects
and modifies tables in the library database.
•Child objects of PCDDocObject (read/write), which get or set
trustees, and perform file uploads and downloads.
Defining a DM
Object
DM Support
Objects
In general, to define a DM object, you need to do the following:
1Create the object in one of the following ways:
—Early bind:
Dim search as PCDSearch
—Late bind:
Dim search as Object
Set search = _
CreateObject("PCDClient.PCDSearch")
2Set the DST using the SetDST method.
3Specify a library for the object.
4Specify the object type (the name of a form).
5Set properties to identify the specific object.
6Perform a method.
The DM support objects provide a number of functions for the DM
Server:
6 CHAPTER 1
•Provide information required for the DM Server log on process.
•Log on to the DM Server.
•Return a document security token (DST) for later transactions.
•Provide additional general objects that do not require a DST.
The following are DM support objects:
The Logon Process
•PCDError
•PCDGetLoginLibs
•PCDLogin
•PCDNetAliasList
DM Query ObjectsQuery objects are used to search the library database. The query is
constructed in memory, e xecut ed, and the results returned to the client
application. The following are DM query objects:
•PCDLookup
•PCDRecentDoc
•PCDSearch
Document ObjectsDocument objects are document management system (DMS) objects
that represent database entities that can be modified. These entities
include profiles, projects, and Quick Searches. The object identifier is:
PCDDocObject
Child Objects of
PCDDocObject
The following are child objects of PCDDocObject objects:
•PCDGetDoc
Objects
•PCDGetStream
•PCDPutDoc
•PCDPutStream
•PCDPropertyList
•PCDTrusteeList
The Logon Process
The following subsections describe the client logon process for DM.
THE DM ARCHITECTURE 7
The Logon Process
Getting a List of
Available Libraries
The following example displays a list of libraries managed by the DM
Server that the user can log on to.
.
.
.
Private Declare Function GetUserName Lib _
"advapi32.dll" Alias "GetUserNameA" _
(ByVal lpbuffer As String, nSize As Long) _
As Long
Public OK As Boolean
Private Sub Form_Load()
Dim sBuffer As String
Dim lSize As Long
Dim libname As String
Dim i As Long
Dim lim As Long
Dim opOK As Boolean
Dim Libs As New PCDGetLoginLibs
'Initialize public variables.
OK = False
dst = ""
user = ""
library = ""
group = ""
'Get the user we are currently logged on as.
sBuffer = Space$(255)
lSize = Len(sBuffer)
Call GetUserName(sBuffer, lSize)
If lSize > 0 Then
txtUserName.Text = Left$(sBuffer, lSize)
Else
txtUserName.Text = vbNullString
End If
'Get the list of available libraries
'and fill in combo box.
Libs.Execute
lim = Libs.GetSize() - 1
opOK = Libs.ErrNumber = 0
LibCombo.Text = ""
For i = 0 To lim
8 CHAPTER 1
The Logon Process
If (opOK) Then
libname = Libs.GetAt(i)
opOK = opOK And Libs.ErrNumber = 0
If i = 0 Then LibCombo.Text = libname
LibCombo.AddItem libname
End If
Next
'List of Network logon types.
NetworkType.AddItem "Network Bindery"
NetworkType.AddItem "Network NDS"
NetworkType.AddItem "Microsoft Network"
NetworkType.Text = ""
End Sub
Private Sub cmdCancel_Click()
OK = False
Me.Hide
End Sub
Providing Library
Access
The next subroutine creates the PCDLogin object. It appends a network
alias to a document security token (DST). The following algorithm is
used:
1Create the PCDLogin object.
2Call the AddLogin method, which provides the logon mode,
logon location, user name, and password.
3Call the Execute method.
4Call the GetDST method.
Note: If there is no network alias, the user name a nd Attaché password are
used. Also, a second logon may be needed when file access occurs, such as
when the user logs on to the DM Server or when a valid user acco unt on a
particular DM Server is required. A second logon may also be required if a
network alias to a DM Server is not set in Library maintenance.
The following example illustrates how you can provide Library logon
support for your users:
Private Sub cmdOK_Click()
Dim login As New PCDLogin
Dim fl As Object
Dim i As Long
THE DM ARCHITECTURE 9
The Logon Process
Dim lim As Long
Dim LoginType As Integer
Dim emsg As String
If (NetworkType = "Network Bindery") Then
LoginType = 1
ElseIf (NetworkType = "Network NDS") Then
LoginType = 2
ElseIf (NetworkType = "Microsoft Network") Then
LoginType = 8
Else
LoginType = 0
End If
If (Domain.Text <> "" And LoginType <> 0) Then
'The Network and Domain are specified, so
'log on to the network.
login.AddLogin LoginType, Domain.Text, _
txtUserName.Text, txtPassword.Text
Else
'Just log on as a Library user.
login.AddLogin 0, library, _
txtUserName.Text, txtPassword.Text
End If
OK = (login.ErrNumber = 0)
If (OK) Then
login.Execute
OK = (login.ErrNumber = 0)
End If
If OK Then
'Set the public variables others will
'need and then hide.
library = login.GetLoginLibrary()
user = login.GetDOCSUserName()
group = login.GetPrimaryGroup()
dst = login.GetDST
Me.Hide
Else
'Unable to log on.
emsg = "Error logging on: " & _
login.ErrNumber & String(1, 13) & _
String(1, 10) & login.ErrDescription
MsgBox emsg, , "Logon"
txtPassword.SetFocus
10 CHAPTER 1
DM Search Transactions
txtPassword.SelStart = 0
txtPassword.SelLength = Len(txtPassword.Text)
End If
'Dump any available information for
'debugging purposes.
Set fl = _
CreateObject("PCDClient.PCDNetAliasList")
Set fl = login.GetFailedLoginList
lim = fl.GetSize() - 1
For i = 0 To lim
Debug.Print "FAILED List: "; _
fl.UnitName(i) & ";" & fl.UnitType(i) _
& ";" & fl.UserName(i)
Next
Set fl = Nothing
Set fl = login.GetAliasList
lim = fl.GetSize() - 1
For i = 0 To lim
Debug.Print "Alias List: "; _
fl.UnitName(i) & ";" & fl.UnitType(i) _
& ";" & fl.UserName(i)
Next
1A user enters search criteria in a user interface from which search
data is extracted. Most commonly, the user interface is a form.
2A search request is sent from the client.
THE DM ARCHITECTURE 11
DM Search Transactions
3The DM Server does the following:
— Captures search criteria, and immediately returns a “no
results” message to the client.
— Performs the search on requested databases and full-text
repositories.
— Collects the results set and sorts it as user specified.
— Caches the results of the search and returns them to the client
when requested.
The cached results can be deleted by the client using the R eleaseResults
method. Also, results may time out based on administration settings.
The following sections describe various ways to execute search
transactions in a DM environment.
General Steps to
Performing a
Search
The following are the general steps in performing a search in the DM
environment:
1Create the search object.
2Set the DST.
3Add a search library (or multiple libraries).
4Set the search object to the name of the search form.
5Add return properties. Properties refer to the field names in the
form. You need to specify the fields to return in the results set.
Alternately, you can set an entire collection of properties using
SetReturnProperties.
6Add search criteria, specifying a field name in the form and its
value.
7Add a property by which the return properties are to be ordered.
8Set the maximum number of rows to return in the results set.
9Optionally, set a chunk factor, which is the number of rows to
return from the server results set into the local cache in one
12 CHAPTER 1
DM Search Transactions
operation. The default is 10. You do not need to repeat the
execution of the search to get the next chunk. DM automatically
does that for you.
10Execute the search.
For the search results returned, you can:
•Obtain the number of rows found.
•Get all the returned properties.
•Iterate through the rows.
•Get values for properties returned by the search.
•Release the results set to free server memory.
Retrieving
Recently Edited
Documents
The following example shows how to retrieve a list of documents that
the user has recently edited.
.
.
.
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim rec As New PCDRecentDoc
Dim i As Long
Dim lim As Long
Dim row As String
Screen.MousePointer = vbHourglass
rec.SetDST DST
rec.AddSearchLib library
'This example uses the CYD_DEFPROF search form.
rec.SetSearchObject "CYD_DEFPROF"
rec.AddSearchCriteria "TYPIST_ID", Chr(3 4) _
& user & Chr(34)
row = row & _
rec.GetPropertyValue("TYP IST _ID") _
& Chr(9)
row = row & _
rec.GetPropertyValue("STATUS")
reGrid.AddItem row
End If
i = i + 1
Wend
rec.ReleaseResults
End If
Screen.MousePointer = vbDefault
End Sub
Private Sub Form_Resize()
Dim i As Long
Dim cw As Long
reGrid.Width = Width - 100
cw = reGrid.Width / reGrid.Cols
For i = 0 To reGrid.Cols - 1
reGrid.ColWidth(i) = cw
Next
End Sub
Private Sub reGrid_Click()
If reGrid.row <= 0 Then
MsgBox "Select valid row"
Exit Sub
End If
Private Sub reGrid_DblClick()
Dim c
Dim dn As Variant
c = reGrid.Col
reGrid.Col = 1
dn = reGrid.Text
If IsNumeric(dn) Then
'Extract routine in frmVersions form_load
THE DM ARCHITECTURE 15
DM Search Transactions
'Versions (dn)
End If
End Sub
Performing a
Simple Search
The following example demonstrates how to do a simple search.
.
.
.
Private Sub cmdCancel_Click()
Me.Hide
End Sub
Private Sub cmdDoLookup_Click()
cboDocType.Clear
Call LookupDocType(cboDocType)
End Sub
Private Sub cmdSearch_Click()
Dim rec As New PCDSearch
Dim i As Long
Dim count As Long
Dim row As String
Screen.MousePointer = vbHourglass
rec.SetDST DST
rec.AddSearchLib library
'This example uses the CYD_DEFPROF form.
rec.SetSearchObject "CYD_DEFPROF"
If txtAuthor <> "" Then
rec.AddSearchCriteria "AUTHOR_ID", _
Chr(34) & txtAuthor & Chr(34)
End If
If txtApp <> "" Then
rec.AddSearchCriteria "APP_ID", Chr(34) _
& txtApp & Chr(34)
End If
If cboDocType <> "" Then
rec.AddSearchCriteria "TYPE_ID", Chr(34) _
& cboDocType & Chr(34)
End If
Private Sub cmdShowLookup_Click()
frmLookup.Show vbModal
End Sub
Private Sub Form_Resize()
Dim i As Long
Dim cw As Long
reGrid.Cols = 8
cw = reGrid.Width / reGrid.Cols
For i = 0 To reGrid.Cols - 1
reGrid.ColWidth(i) = cw
Next
End Sub
Private Sub reGrid_Click()
If reGrid.row <= 0 Then
MsgBox "Select valid row"
Exit Sub
End If
The steps for working with the PCDDocObject object and other DM
API objects are as follows:
1Set the DST.
2Set the object type property to the name of the form.
3Set the library as a property of the object.
4Set the object properties, each of which requires a name/value
pair.
Fetching a DM
Document Object
5Once all the relevant properties have been set, create the object.
There are also methods for fetching information on the properties of an
object as well as deletion and update methods.
The following example fetches a DM document object.
.
.
.
Attribute VB_Name = "frmFetchDoc"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim ret As Boolean
Dim i As Long
Dim FileName As String
Dim FetchFlag As Boolean
Private Sub cmdCheckIn_Click()
THE DM ARCHITECTURE 19
Document Objects
Dim doc As New PCDDocObject
If docnumber = "" Or versionid = "" Then
MsgBox "Check In requires that you set " _
& "the document number and " _
& "the version ID."
Exit Sub
End If
'Check for error.
Dim lngENum As Long
lngENum = doc.ErrNumber
If lngENum <> 0 Then
Dim strEDesc As String, strENum As String
strEDesc = doc.ErrDescription
strENum = CStr( lngENum )
MsgBox "Error " & strENum & ": " & strEDesc
'Handle the error...
End If
Set doc = Nothing
Set doc = New PCDDocObject
doc.SetDST DST
doc.SetObjectType "cyd_defprof"
doc.SetProperty "%TARGET_LIBRARY", library
doc.SetProperty "%OBJECT_IDENTIFIER", docnum ber
doc.Fetch
'Check for error.
Dim lngENum As Long
lngENum = doc.ErrNumber
If lngENum <> 0 Then
Dim strEDesc As String, strENum As String
strEDesc = doc.ErrDescription
strENum = CStr( lngENum )
MsgBox "Error " & strENum & ": " & strEDesc
'Handle the error...
End If
20 CHAPTER 1
Document Objects
txtStatus = doc.GetReturnProperty("STATUS")
Set doc = Nothing
If txtStatus = 0 Then
cmdCheckOut.Enabled = True
cmdCheckIn.Enabled = False
Else
cmdCheckOut.Enabled = False
cmdCheckIn.Enabled = True
End If
MsgBox "Status field in profile updated " _
& "to 0 (checked in)."
End Sub
.
.
.
Private Sub FetchButton_Click()
Dim rec As New PCDGetDoc
Dim i As Long
Dim lim As Long
Dim opOK As Boolean
Dim row As String
Dim gd As Object
Dim indata As Variant
Dim bdata() As Byte
If docnumber = "" Or versionid = "" Then
MsgBox "Must specify the document number " _
& "and the version ID."
Exit Sub
End If
If (rec.ErrNumber <> 0) Then
MsgBox "Fetch Doc Failure on Execute: " & _
rec.ErrNumber & " " & rec.ErrDescription, _
, "Fetch Doc"
Else
lim = rec.GetRowsFound
i = 1
While i <= lim
rec.NextRow
If (rec.ErrNumber <> 0) Then
i = lim + 1
MsgBox "Fetch Doc Failure on Execute: " _
& rec.ErrNumber & " " & _
rec.ErrDescription, , "Fetch Doc"
End If
If (i = 1) Then
Set gd = rec.GetPropertyValue("%CONTENT")
On Error GoTo saveFailed
FileName = "c:\temp\" & _
Trim(docnumber) & "_" & _
Trim(versionid) & ".doc"
Open FileName For Binary Access Write _
As #1
bdata() = ""
bdata() = gd.Read(1024)
While (gd.BytesRead > 0)
Put #1, , bdata()
bdata() = ""
bdata() = gd.Read(1024)
Wend
Close #1
GoTo saveDone
saveFailed:
MsgBox "Fetch Doc Failure File Open: " _
& "Fetch Doc"
savecancelled:
On Error Resume Next
saveDone:
End If
i = i + 1
Wend
22 CHAPTER 1
Document Objects
End If
FetchFlag = True
MsgBox "Exported document content to " _
& "designated file: " & FileName
End Sub
.
.
.
Getting and
Updating Trustee
Information
The following example updates the trustees for a profiled document
object.
Dim bRet As Boolean
Dim Status As String
Dim DocName As String
Dim DefaultRights As Long
Dim EffectiveRights As Long
Dim AccessControl As Boolean
Dim i As Integer
Dim UserOrGroup As String
Dim PDoc As Object
Dim TrusteeList As PCDTrusteeList
Private Function _
GetTrusteesforProfile(docnumber As String) _
As Boolean
Dim docsfound As Long
On Error GoTo ErrorHandler
GetTrusteesforProfile = False
If Val(docnumber) <= 0 Then Exit Function
Dim pclient As PCDSearch
THE DM ARCHITECTURE 23
Document Objects
Set pclient = _
CreateObject("PCDClient.PCDSearch")
pclient.SetDST DST
pclient.AddSearchLib library
'This example uses the "def_qbe" form.
pclient.SetSearchObject "def_qbe"
'Set the properties to be returned. These
'are the properties to be displayed in the
'search results page.
pclient.AddReturnProperty("DOCNAME")
pclient.AddReturnProperty("DOCNUM")
pclient.AddReturnProperty("AUTHOR_ID")
pclient.AddReturnProperty("STATUS")
pclient.AddReturnProperty("VERSION")
pclient.AddReturnProperty("SECURITY")
pclient.AddReturnProperty("VERSION_ID")
pclient.AddOrderByProperty "VERSION_ID", True
pclient.AddSearchCriteria "DOCNUM", docnumber
pclient.Execute
'Check for error.
Dim lngENum As Long
lngENum = pclient.ErrNumber
If lngENum <> 0 Then
Dim strEDesc As String, strENum As String
strEDesc = pclient.ErrDescription
strENum = CStr( lngENum )
MsgBox "Error " & strENum & ": " & strEDesc
'Handle the error...
End If
docsfound = pclient.GetRowsFound
txtDocsFound = Str(docsfound)
If docsfound = 0 Then
Set pclient = Nothing
Exit Function
End If
'Check for error.
Dim lngENum As Long
lngENum = PDoc.ErrNumber
If lngENum <> 0 Then
Dim strEDesc As String, strENum As String
strEDesc = PDoc.ErrDescription
strENum = CStr( lngENum )
MsgBox "Error " & strENum & ": " & strEDesc
'Handle the error...
End If
'Only display trustees if security is set.
If DefaultRights Then
Call DisplayTrustees(PDoc, _
TreeTrustees, AccessControl)
If AccessControl Then
cmdAddTrustee.Enabled = True
cmdRemoveTrustee.Enabled = True
End If
Else
MsgBox "No security set for this profile."
End If
End Function
.
.
.
Private Sub cmdAddTrustee_Click()
'Two ways to do this:
'1) Set trustee on profile object and
' update trustees.
Set PDoc = _
CreateObject("PCDClient.PCDDocObject")
PDoc.SetDST DST
PDoc.SetProperty "%TARGET_LIBRARY", library
PDoc.SetObjectType("DEF_PROF")
PDoc.SetProperty "%OBJECT_IDENTIFIER", docnumber
PDoc.FetchTrustees
'Set flags to 1 for group and 2 for user, but
'0 may work.
PDoc.SetTrustee cboTrustees.Text, 2, _
Val(txtRights)
'Check for error.
Dim lngENum As Long
lngENum = PDoc.ErrNumber
If lngENum <> 0 Then
Dim strEDesc As String, strENum As String
strEDesc = PDoc.ErrDescription
strENum = CStr( lngENum )
MsgBox "Error " & strENum & ": " & strEDesc
'Handle the error...
End If
PDoc.UpdateTrustees
'Check for error.
Dim lngENum As Long
26 CHAPTER 1
Document Objects
lngENum = PDoc.ErrNumber
If lngENum <> 0 Then
Dim strEDesc As String, strENum As String
strEDesc = PDoc.ErrDescription
strENum = CStr( lngENum )
MsgBox "Error " & strENum & ": " & strEDesc
'Handle the error...
End If
PDoc.Update
'Check for error.
Dim lngENum As Long
lngENum = PDoc.ErrNumber
If lngENum <> 0 Then
Dim strEDesc As String, strENum As String
strEDesc = PDoc.ErrDescription
strENum = CStr( lngENum )
MsgBox "Error " & strENum & ": " & strEDesc
'Handle the error...
End If
Set PDoc = Nothing
MsgBox "Trustee " & cboTrustees.Text & _
" has been added."
Exit Sub
'2) Add trustee to the trustees collection
' and update trustees.
PDoc.FetchTrustees
TrusteeList.AddTrustee cboTrustees.Te xt, _
2, Val(txtRights)
PDoc.SetTrustees TrusteeList
PDoc.UpdateTrustees
'Check for error.
Dim lngENum As Long
lngENum = PDoc.ErrNumber
If lngENum <> 0 Then
Dim strEDesc As String, strENum As String
strEDesc = PDoc.ErrDescription
strENum = CStr( lngENum )
MsgBox "Error " & strENum & ": " & strEDesc
'Handle the error...
End If
THE DM ARCHITECTURE 27
Document Objects
PDoc.Update
'Check for error.
Dim lngENum As Long
lngENum = PDoc.ErrNumber
If lngENum <> 0 Then
Dim strEDesc As String, strENum As String
strEDesc = PDoc.ErrDescription
strENum = CStr( lngENum )
MsgBox "Error " & strENum & ": " & strEDesc
'Handle the error...
End If
End Sub
.
.
.
28 CHAPTER 1
Chapter
2
An Overview of the DM API
In This Chapter
This chapter describes the overall structure of the DM API, including
an itemized list that shows the methods and properties that each object
supports. It also presents information that applies across the entire API.
AN OVERVIEWOFTHE DM API 29
The PCDClient Object
The PCDClient Object
Your custom applications interact with the DM Server through a
number of objects that are collectiv ely referred to as the
use the
the Distributed Component Object Model (DCOM).
PCDClient objects, you should have some understanding of
List of DM API Objects
The following is a list of the DM client objects that comprise the DM
API.
You can create objects in the DM API using either early binding or late
binding. Examples shown in this document will sometimes use early
binding, and other times will use late binding. In custom applications
you implement, you can usually use either , but there are a few instances
where the text will indicate that one should be used in preference to the
other.
Early BindingWith early binding you create an object in a single step when you first
dimension it. This may be the most appropriate wa y to creat e an object
if you are going to use it immediately.
Early binding uses the New keyword within the Dim statement when
the object is first dimensioned. For example:
Dim pDoc As New PCDClient.PCDPutDoc
The New operator must be used on Visual Basic objects that have
Private or PublicNotCreatable instancing properties.
Late BindingWith late binding you first dimension the it em you want to create, ofte n
dimensioning it as a generic object. Later, when you are r eady to use the
object, you use the
For example:
Dim pObj As Object
...
Set pObj = CreateObject(“PCDClient.PCDLookup”)
If your application uses the Microsoft Transaction Server, you must
create objects using late binding with the
Transaction Server cannot see instances of externally created objects
that you generate with the
Set statement to instantiate the object in memory.
CreateObject method. The
New operator.
AN OVERVIEWOFTHE DM API 31
Methods and Properties Supported by DM API Objects
Each of the DM API objects supports two or more methods or
properties that perform the various tasks related to that object. The
methods and properties that each DM API object supports are listed
below.
Many
PCDClient objects support methods and properties with the
same name. For example, all
ErrNumber and ErrDescription properties.
To avoid repeating the information by discussing methods and
properties with the objects they support, methods and properties are
discussed separately. Chapter 3 presents DM API objects. Chapter 4
discusses the rich array of methods and properties available in the
DM API.
Tokens are special identifiers that instruct the DM Server to perform
specific actions. They are often used as a short-hand reference to an
object that otherwise could only be described by a longer text string,
such as a reference to a SQL table and column. For example, the
%LOGIN_DATE token can substitute for as a reference for the
PEOPLE.LAST_LOGIN_DATE column of the SQL database.
Token identifiers are easily r ecognized. W hen used in application code,
each token must be enclosed within double quote marks and must
always be written in UPPERCASE. Each token begins with a percent
sign (%), a syntax requirement that identifies them as DM system
variables rather than local variables defined by the API program.
When used in application code, DM tokens perform one of three
functions:
•Tokens set values either in the SQL database or in other variables.
For example, the %CHECK OUT_COMMENTS token can be used
to identify a string that the program stores in the COMMENTS
column of the CHECKOUT table.
•Tokens identify data items that API applications are to return
when the application executes. For example, the %DATA token
returns the data and metadata associated when an application
program executes the PDCSQL operation.
•Tokens manipulate column values in SQL dat abase tables. For
example, the %CONTENTS_MOVE_TO_TOP adjusts the items
in a DM Folder so that the specified object is shown at the top of
the presentation list and the other items in the folder are adjust ed
to lower positions in the list if necessary.
Chapter 5, “DM API Tokens” on page 301, lists the most commonly
used DM tokens.
AN OVERVIEWOFTHE DM API 41
Tokens Supported by DM API Methods and Properties
42 CHAPTER 2
Chapter
3
DM API Objects
In This Chapter
This chapter describes each of the DM objects, including their syntax,
usage, and other related information.
DM API OBJECTS 43
PCDASPFileUpload
PCDASPFileUpload
Use this object only from scripts running inside Active Server Pages
(ASP). This object is used to read from the ASP Request object and
write to the supplied PCDPutStream object.
Syntax
PCDASPFileUpload.
methodOrProperty
Usage
The PCDASPFileUpload object is a client-side interface (CSI) object
used to extract form data (specifically, uploaded files) from the
requested object when a form is submitted. When uploading a file,
ENCTYPE is set to “multipart/form-data.” A server-side c omponent is
required to parse the information c ontained within the file. This utility
is used in conjunction with the PCDPutDoc object to write the data
stream to the document server.
To demonstrate the process, open the DM Webtop
file. Locate the following line of code (where
UPLOADDSP.ASP
[...] markers indicate
that the same line of code continues on the next line of the page):
<INPUT type=”button” Value=”<%=getString(([...]
isImportVersion)?”IMPORT_BUTTON1”:”UPLOAD_[...]
HEADER”)%>” onclick=”submitF un ct ion () ”>
44 CHAPTER 3
Assuming that you are not using the DM Webtop Smart CheckIn/
CheckOut feature, when the form is submitted, your Internet browser
knows that you are uploading a file and will prompt you with an Input
File dialog box that contains a Browse button. Select the file to be
uploaded. The file itself is embedded as part of the form via the POST
method. In
used to extract the file from the
UPLOADACT.ASP, the PCDASPFileUpload component is
REQUEST object.
PCDASPFileUpload
PCDASPFileUpload is a helper class/interface/object that supports the
tying of t he
(The
POST.) It handles all the parsing of headers from the body content and
streaming of the file that is to be uploaded into the DM PCDPutStream
object.
The OnStartPage method initializes the COM interface pointers to all
of the ASP objects, such as Session, Application, Request, Response,
and Server. These are passed by the ASP engine from the interface
pointer.
The Execute method reads from the ASP Request object that is
obtained during OnStartPage. It uses the
to the PCDPutStream object that the server supplies.
The IsEmpty method can be used to determine if the body of the
content is empty, which would indicate that a zero-byte file was sent.
IsEmpty looks at the posted stream, parses out the header, and
determines if the document being sent is empty. If the c ontent is empty ,
the success return value is set to
PCD_ERR_ZERO_BYTE_UPLOAD. If the body content is not empty, the
success return value is set to
POST of an ASP Multipart/Fo rm file into a PCDPutStream.
GET method is not supported in PCDPutStream, so always use
ReadBinary method to write
TRUE, and the error state is set to
FALSE, and no error condition is set.
The OnEndPage method releases all the interface pointers acquired
during the OnStartPage initialization and resets the error state.
Example
The following is an example of creating an instance of the
PCDASPFileUpload.
.
.
.
Dim pFile As Object
.
.
.
pFile = _
Server.CreateObject("PCDClient.PCDASPFileUpload”
)
DM API OBJECTS 45
PCDASPFileUpload
Related Items
See the following methods:
See the following properties:
.
.
.
Execute
IsEmpty
OnEndPage
OnStartPage
ErrDescription
ErrNumber
46 CHAPTER 3
PCDDocObject
PCDDocObject
This object is one of the true workhorses of the DM API. Custom
applications use it to manipulate Document objects. Document objects
include such elements as Document Profiles, search forms, and
versions.
Syntax
PCDDocObject.
methodOrProperty
Example
The following is an example of creating an instance of the
PCDDocObject.
This object allows you to iterate through collections of property lists.
Most often used with documents and folders, PCDEnumP r opertyLists
also allows you to iterate through the property lists associated with
collections of versions, root objects, and other items. For example, if a
folder is deleted, all of the documents and folders it contained must
have their properties updated to indicate that they are no longer
contained in the deleted folder.
PCDEnumPropertyLists supports COM-standard enumeration
interface methods. Every COM-standard enumeration object supports
Clone, Next, Reset, and Skip methods.
Syntax
PCDEnumPropertyLists.
Related Items
See the following methods:
Clone
Next
Reset
Skip
See the following properties:
ErrDescription
ErrNumber
methodOrProperty
DM API OBJECTS 49
PCDError
PCDError
This object is a base object for all other PCDClient objects. It provides
common properties that you access through the other objects to get
error information.
Usage
You do not have to create an instance of this object. All other
PCDClient methods access it directly.
Example
All PCDClient objects can access the PCDError objects properties
without creating a PCDError object in their application. Most of the
sample code in this guide contains examples of how the ErrNumber
and ErrDescription properties are accessed.
The section titled Fetching a DM Document Object in Chapter 1 is one
of the many examples that illustrate how you can use PCDError
properties in your custom applications.
50 CHAPTER 3
Related Items
See the following properties:
ErrDescription
ErrNumber
PCDGetDoc
PCDGetDoc
This object is used to manage the retrieval of a set of physical files that
comprise the components of one version of a document. You use this
object just as you would the PCDSearch object. Use
PCDGetDoc.AddSearchCriteria to specify the criteria that identify
which document and version you want. Normally, this would mean
specifying criteria like
"%VERSION_ID" "3"
one version of one document.
"%DOCUMENT_NUMBER" "79",
. The provided criteria must resolve to exactly
Syntax
PCDGetDoc.
methodOrProperty
Returns
PCDGetDoc returns data stored in the COMPONENTS table, including
the document number, version ID, size of the file, and the name of the
file.
Usage
The following steps show the general usage sequence for the
PCDGetDoc object:
1Specify the library where the document is stored.
2Provide a DST.
3Set search criteria that will precisely identify the item you wish to
retrieve.
4Call PCDGetDoc.Execute method to retrieve the document.
5Iterate through them using PCDGetDoc.NextRow or call
PCDGetDoc.SetRow to get to a specific item.
6Call PCDGetDoc.GetPropertyValue to retrieve the file content by
referencing the "%CONTENT" token. This will return a pointer to a
Dispatch interface (a
use to read the physical file.
PCDGetStream object) that you can then
DM API OBJECTS 51
PCDGetDoc
7After file retrieval is complete, release memory associated with
your PCDGetDoc object.
52 CHAPTER 3
PCDGetDoc
Example
The following example shows you can use PCDGetDoc to retrieve the
name of a file that contains a document in your DM repository.
Use this object to retrieve information contained in the FORMS table in
the SQL database. It is presently used specifically for the JavaForms
interface.
Syntax
PCDGetForm.
methodOrProperty
Example
The following example shows how to create an instance of this object.
Use this object to get a list of available logon libraries from the DM
Server. This is a list of the libraries configured in DM Server Manager,
and they are obtained from a PCDOCS.INI file in the system.
Syntax
PCDGetLoginLibs.
methodOrProperty
Usage
This object allows you to determine which libraries are available for use
by a user. Users can log on to any libraries this object returns. You also
use it to select the current working library.
Example
The following example assembles the libraries available to the current
user and puts them into a ListBox.
.
.
.
Dim objGetLibs As New PCDGetLoginLibs
Dim LNumOfLibs As Long
Dim strLibName() As String
Dim LCounter
Dim lstLibList As New ListBox
'Set the DST.
objGetLibs.SetDST strDST
' Get a list of libraries available to the use r.
objGetLibs.Execute
If (objGetLibs.ErrNumber <> 0) Then
' Error occurred. Process it as appropriate.
End If
'Get the number of libraries.
LNumOfLibs = objGetLibs.GetSize - 1
56 CHAPTER 3
PCDGetLoginLibs
Related Items
See the following properties:
ReDim strLibName(LNumOfLibs)
For LCounter = 0 To LNumOfLibs
strLibName(LCounter) = _
objGetLibs.GetAt(LCounter)
lstLibList.AddItem strLibName
Next
Set objGetLibs = Nothing
.
.
.
Execute
GetAt
GetSize
ErrDescription
ErrNumber
DM API OBJECTS 57
PCDGetStream
PCDGetStream
Use this object to pro vide the user with a way to read the contents of a
physical file.
Syntax
PCDGetStream.
methodOrProperty
Usage
When calling this object, after each Read, you should check the
ErrNumber property. If ErrNumber returns zero (indicating that no
error occurred), you should check the BytesRead property to see how
many bytes were actually returned by the Read.
Note: If you are using a language such as Visual Basic or Visual C++, you can
use the optional second parameter for Read to get the number of b ytes read,
instead of checking the BytesRead property.
Example
The following example shows how PCDGetStream can be used to
determine the length of a document in your DM Repository.
.
.
.
'Assumptions for this example:
' - bstrDocNum already contains doc number.
' - bstrDST already contains security to ke n.
' - bstrLib already contains library name.
' - bstrVerNum already contains the document
' version number.
'Object to get Doc information
Dim objDOC As New PCDDocObject
'Create our Stream object
Dim objGetStream As New PCDGetStream
'Vars to hold byte counts.
Dim blnLoopCtrl As Boolean
Set blnLoopCtrl = False
'Set the Form (here the Default Profile For m) .
objDOC.SetObjectType "DEF_PROF"
'Get the document.
objDOC.SetProperty "%OBJECT_IDENTIFIER", _
bstrDocNum
objDOC.Fetch
If objDOC.ErrNumber <> 0 Then
' Error occurred during Fetch. Process it.
End If
'Create/Set-up object to get the document.
Dim objGetDoc As New PCDGetDoc
objGetDoc.SetDST bstrDST
objGetDoc.AddSearchCriteria "%TARGET_LIBRARY", _
bstrLib
objGetDoc.AddSearchCriteria "%DOCUMENT_NUMBER",
_
bstrDocNum
objGetDoc.AddSearchCriteria "%VERSION_ID", _
bstrVerNum
objGetDoc.Execute
If objGetDoc.ErrNumber <> 0 Then
' Error occurred: Process it.
End If
If (objGetStream <> 0) Then
'Error: Unexpected end to read loop.
Else
If (lngTotCount > 0) Then
MsgBox "Done. File is " & _
CStr(lngTotCount) & _
" Bytes in Length."
Else
'Error: Read Failed. Process the error.
End If
End If
Set objDoc = Nothing
Set objGetDoc = Nothing
Set objGetStream = Nothing
.
.
.
60 CHAPTER 3
Related Items
See the following methods:
GetPropertyValue
Read
Seek
SetComplete
See the following properties:
BytesRead
ErrDescription
ErrNumber
PCDLogin
PCDLogin
Use this object to create or append validated network aliases to a
document security token (DST)
Syntax
PCDLogin.
methodOrProperty
Example
The section titled Providing Library Access in Chapter 1 illustrate s how
you can use the PCDLogin object in your documents.
PCDLookup allows you to execute a lookup of data stor ed in validat ed
SQL columns, such as
PCDLookup to do this in your custom application by specifying:
•the data in the fields on the form, and
•the lookup ID.
PCDLookup returns the same data that would be displayed in the list
box of the DM lookup, plus any other columns that would be needed
to update related fields on the base form. For example, if you use the
Matter lookup definition, the column for the Client_ID will also be
returned.
AUTHOR or DOCUMENTTYPE. You can use
Syntax
62 CHAPTER 3
PCDLookup.
methodOrProperty
Usage
This object works differently than the PCDSearch object in that you
don’ t specify return properties. The server determines what they should
be by looking at the lookup definition and the base form.
All the columns in the list box on the lookup will be included as return
properties, plus the contents of any “r elated data” columns that need to
be updated on the form when the lookup’s target field changes.
Also, unlike PCDSearch, you have to specify a target property. This is
the field you are trying to fill in using the lookup (for example, Author
or Matter).
After you Execute the lookup, you get back data and metadata. The
metadata tells you what columns are in the data. The metadata c olumns
include the following return properties: %PropertyName, %Title,
%Visible, and %Data.
PCDLookup
Example
The following example demons trates ho w you can use PCDLookup to
create and process a Lookup search. It includes most of the methods
that PCDLookup supports.
Sub Lookup( )
'Create our object
Dim objPCDLookup As New PCDLookup
'Create a property list
Dim objPCDPropList As New PCDPropertyList
'Set up our propertylist so it can be used later.
objPCDPropList.AddProper t y "AUTHOR_ID", "J_SMITH"
'Set up the parameters for the lookup.
'Set the DST.
objPCDLookup.SetDST strDST
'Set the Library.
objPCDLookup.AddSearchLib strLib
'Set the search object. This form must contain
'the lookup (such as client or matter).
objPCDLookup.SetSearchObject( "DEF_Q BE 1" )
'Set the Lookup name.
objPCDLookup.SetLookupId "PEOPLE "
'Set the target property to look up.
objPCDLookup.SetTargetProperty "AUTHOR_ID"
'Set the search criteria.
objPCDLookup.SetSearchCriteria objPCDPropList
'Set the filter criteria.
objPCDLookup.AddUserFilterCriteria "AUTHOR_ID", "J*"
'Determine fields to search.
Dim strAns As String, intAns As Integer
Dim strPrompt As String, strTitle As String
strTitle = "Author or Author/Typist Search “ _
& “Selection"
strPrompt = "Current search is only in “ _
& “Author field.” & vbCr & "Do you “ _
& “also wish to search for the person" & _
DM API OBJECTS 63
PCDLookup
vbCr & "you selected in the Typist field?"
strAns = MsgBox(strPrompt, vbYesNo, strTitle)
intAns = CInt(strAns)
If intAns = 6 Then
'User answered "Yes." Broaden search.
objLookup.AddSearchCriteria “TYPIST_ID", J_SMITH
'Also, delete filter on author name so it
'does not exclude J_SMITH as typist.
objLookup.ClearUserFilterCriteria
Else If intAns = 7
'User answered "No." Search is OK as is.
MsgBox "No change to search criteria."
End If
'Set the sort order for results.
strTitle = "SORT ORDER"
strPrompt = "Select the number of “ _
& “the Sort Order: " _
& vbCr & " 1 - Author, ascending sort " _
& vbCr & " 2 - Author, descending sort " _
& vbCr & " Other - Unsorted results "
strAns = InputBox(strPrompt, strTitle)
If IsNumeric(strAns) Then
intAns = CInt(strAns)
Else
intAns = 9 'Can be any integer.
End If
Select Case intAns
Case 1
'Sort by author, ascending order.
'The Boolean value that follows AUTHOR_ID ca n be
'anything except zero (or an expression that
'evaluates to zero).
objPCDLookup.AddOrderByProperty "AUTHOR_ID", 1
Case 2
'Sort by author, descending order.
objPCDLookup.AddOrderByProperty "AUTHOR_ID", 0
Case Else
64 CHAPTER 3
PCDLookup
'Unsorted. This assures unsorted results, but
'it may not be required unless there were
'previous searches.
objPCDLookup.ClearOrderByProperties
End Select
'Set the maximum number of records search returns.
objPCDLookup.SetMaxRows 500
'Set the number of records to be returned at
'one time to user’s local cache.
objPCDLookup.SetChunkFactor 10
'Execute the lookup
objPCDLookup.Execute
If objPCDLookup.ErrNumber <> 0 Then
'Error: process it.
End If
'Get the information from the result set
Dim intColCount As Integer
Dim lngRowsFound As Long, lngMetaFound As Long
'Get the number of data rows found by the lookup.
lngRowsFound = objPCDLookup.GetRowsFound
MsgBox "The search returned " _
& CStr( lngRowsFound ) & " rows of data."
'Get the number of metadata rows lookup found.
lngMetaFound = objPCDLookup.GetMetaRowsFound
MsgBox "The search returned " _
& CStr( lngMetaFound ) & " rows of metadata."
'Get the number of columns in the result data set.
intColCount = objLookup.ColumnCount
MsgBox "The search result data set contains " _
& CStr( intColCount ) & " columns of data."
'Clear the result set list box (if needed).
DM API OBJECTS 65
PCDLookup
lstResultSet.Clear
'Set pointer position to row 0 in the result set.
'NextRow will then increment it to the first data
'row.
objPCDLookup.SetRow( 0 )
Do While objPCDLookup.NextRow
If objPCDLookup.ErrNumber <> 0 Then
'Error reading data row. Process it.
End If
'Set pointer position to row 0 in the metadata
'result set. NextMetaRow will then increme nt
'it to the first data row.
objPCDLookup.SetMetaRow (0)
Do While objPCDLookup.NextMetaRow
If objPCDLookup.ErrNumber <> O Then
'Error reading metadata row. Process it.
End If
'Retrieve short name of the metadata property.
lstResultSet.AddItem _
objPCDLookup.GetMetaPropertyValue( _
"PROPNAME")
'Shows whether column is Visible: 0=No
lstResultSet.AddItem _
objPCDLookup.GetMetaPropertyValue( _
"VISIBLE")
'Long Name of the metadata property.
lstResultSet.AddItem _
objPCDLookup.GetMetaPropertyValue("TITLE")
'The lookup data associated with
'this metadata property.
lstResultSet.AddItem _
objPCDLookup.GetMetaPropertyValue("DATA")
lstResultSet.Show
MsgBox "ListBox displays metadata “ _
“for current row."
lstResultSet.Hide
lstResultSet.Clear
66 CHAPTER 3
PCDLookup
Loop
Loop
'Cleanup...
objPCDLookup.ReleaseResults
Set objPCDLookup = Nothing
Set objPCDPropList = Nothing
The PCDNetAliasList object stores a list of network aliases. A network
alias consists of the following:
•a UnitType
•a UnitName
•a UserName and Password
The UnitType is a DM library, or a NetWare 5.x, NetWare 6.x, or
Microsoft Network. Depending on the
either a DM library name, the NetWare server name , the NetWare NDS
tree name, or the Windows network domain name, respectively. Note
that this object accepts and stores passw ords, but it does not allow them
to be retrieved.
UnitName, the UnitType is
Syntax
68 CHAPTER 3
PCDNetAliasList.
methodOrProperty
Example
The section titled Providing Library Acc ess in Chapter 1 illustrates how
you can use the PCDNetAliasList object in your custom applications.
Related Items
See the following methods:
GetSize
UnitName
UnitType
UserName
See the following properties:
ErrDescription
ErrNumber
PCDNetworkInfo
PCDNetworkInfo
The PCDNetworkInfo object supports the integration of DM with your
network-based security. The methods PCDNetworkInfo supports
allow you to build tight network operating system integration into your
DM document management system. These methods also allow you to
browse network information about domains, groups, and users.
Syntax
PCDNetworkInfo.MethodOrProperty
Usage
Use methods supported by PCDNetworkInfo to make inquiries of
current network elements within your network environment. You can
retrieve information about Domains, Groups, and U sers. Most of these
methods load a result set with data. You retrieve data from these result
sets by using a pair of methods in conjunction with one another:
NextRow and GetValue.
Example
The following example illustrates the use of PCDN etw orkInfo and the
methods it supports.
DM API OBJECTS 69
PCDNetworkInfo
Public sDST As String
Private Sub cbDomain_Click()
DomainForm.oNWInfo.SetDST (sDST)
DomainForm.Show
End Sub
Private Sub cbGroupInfo_Click()
GroupForm.sDST = sDST
GroupForm.oGroupInfo.SetDST (sDST)
GroupForm.Show
End Sub
Private Sub cbQuit_Click()
Unload NetInfoBaseForm
End Sub
Private Sub Form_Load()
'Local Variable declarations.
Dim oLogin As New PCDLogin
Dim nResult As Long
Dim sTempBuf As String
'Initialize this list to its first element.
lstDomains.ListIndex = 0
'Fill up the UserList with Users in this list.
nResult = oNWInfo.GetUserList("%NI_NT", _
lstDomains.Text)
nNumRows = 0
'Get number of rows that are returned.
If nResult = 0 Then
nNumRows = oNWInfo.GetRowCount()
End If
'Display the list of users in the
'lsDomainUsers listbox.
If nNumRows = 0 Then
MsgBox "User information for this domain “ _
& “is not available to you."
Else
For i = 1 To nNumRows
nResult = oNWInfo.NextRow()
lstDomainUserList.AddItem ( _
oNWInfo.GetValue())
Next i
72 CHAPTER 3
PCDNetworkInfo
'Pre-select the first item in the list.
lstDomainUserList.ListIndex = 0
End If
End If
End Sub
Private Sub lstDomains_Click()
Dim nResult As Long
Dim nNumRows As Long
'Clear listbox for results of this call.
lstDomainUserList.Clear
'Fill the UserList with Users within this list.
nResult = oNWInfo.GetUserList("%NI_NT", _
lstDomains.Text)
nNumRows = 0
'Get the number of rows that are returned.
If nResult = 0 Then
nNumRows = oNWInfo.GetRowCount()
End If
'Display users in the lstDomainUsers listbox
If nNumRows = 0 Then
MsgBox "User information for this domain “ _
& “is not available to you."
Else
For i = 1 To nNumRows
nResult = oNWInfo.NextRow()
lstDomainUserList.AddItem( _
oNWInfo.GetValue())
Next i
DM API OBJECTS 73
PCDNetworkInfo
'Pre-select the first item in the list.
lstDomainUserList.ListIndex = 0
End If
End Sub
74 CHAPTER 3
Public sDomainName As String
Public sGroupName As String
Public sDST As String
Public oGroupInfo As New PCDNetworkInfo
Private Sub cbCancel_Click()
Unload GroupForm
End Sub
Private Sub cbIsMember_Click()
Dim nResult As Long
nResult = IsMemberForm.oIsMember.SetDST(sDST)
'Before loading the next form use load
'load the next form's Group and Domain
'data members.
GroupMembersForm.sGroupName = sGroupName
GroupMembersForm.sDomainName = sDomainName
'Set the next form's object DST.
nResult = GroupMembersForm.oMembers.SetDST(sDST)
GroupMembersForm.Show
End Sub
Private Sub Form_Load()
Dim nResult As Long
Dim sName As String
Dim nNumRows As Long
'Load up the Domain List.
nResult = oGroupInfo.GetDomainList( _
"%NI_NT", "%UNDEFINED")
nNumRows = 0
'If the Domain list has been retrieved,
'get the number of domains in the list.
DM API OBJECTS 75
PCDNetworkInfo
If nResult = 0 Then
nNumRows = oGroupInfo.GetRowCount()
End If
If nNumRows = 0 Then
MsgBox "You do not have access to “ _
& “Domain information at this time."
Else
'Fill ListBox with Domain information.
For i = 1 To nNumRows
If nResult = 0 Then
nNumRows = oGroupInfo.GetRowCount()
End If
'If no rows are returned then place that
'information in the ListBox. Otherwise, place
'the list of all groups in the ListBox.
If nNumRows = 0 Then
lstGroups.AddItem "NO GROUPS FOR THIS DOMAIN "
Else
For i = 1 To nNumRows
nResult = oGroupInfo.NextRow()
lstDomains.AddItem (oGroupInfo.GetValue())
Next i
76 CHAPTER 3
PCDNetworkInfo
End If
End If
cbGetMembers.Enabled = False
End Sub
Private Sub lstDomains_Click()
sDomainName = lstDomains.Text
lstGroups.Clear
'Fill the UserList with Users in this list.
nResult = oGroupInfo.GetGroupList( _
"%NI_NT", sDomainName)
nNumRows = 0
'Get the rowcount.
If nResult = 0 Then
nNumRows = oGroupInfo.GetRowCount()
End If
'Display user list in the lstGroups ListBox.
If nNumRows = 0 Then
MsgBox "User information for this domain “ _
“is not available to you."
Else
For i = 1 To nNumRows
'Pre-select the first item in the list.
lstGroups.ListIndex = 0
sGroupName = lstGroups.Text
cbGetMembers.Enabled = True
End If
DM API OBJECTS 77
PCDNetworkInfo
End Sub
Private Sub lstGroups_Click()
sGroupName = lstGroups.Text
cbGetMembers.Enabled = True
End Sub
78 CHAPTER 3
Public oMembers As New PCDNetworkInfo
Public sDomainName As String
Public nFirstTime As Long
Public sGroupName As String
Private Sub cbCancel_Click()
Unload GroupMembersForm
End Sub
Private Sub Form_Load()
Dim nResult As Long
PCDNetworkInfo
Dim sMember As String
Dim nNumRows As Long
'Retrieve the GroupMembers from the netwo rk
nResult = oMembers.GetGroupMembers( _
"%NI_NT", sDomainName, sGroupName)
If nResult = 0 Then
'Get the Group members.
nNumRows = oMembers.GetRowCount()
If nNumRows = 0 Then
MsgBox "No access to Members for this group."
Else
'Place all of the members of this group
'in the ListBox.
For i = 1 To nNumRows
nResult = oMembers.NextRow()
lstMembers.AddItem (oMembers.GetValue())
Next i
'Select the first member in the list.
lstMembers.ListIndex = 0
End If
Else
'No members in this group.
lstMembers.AddItem sDomainName + "No Members"
End If
nFirstTime = 1
End Sub
Private Sub lstMembers_Click()
Dim nResult As Long
DM API OBJECTS 79
PCDNetworkInfo
Dim nNumRows As Long
'If program is now checking the top of Member
'list from the opening of the form...
If nFirstTime > 0 Then
'...Clear the Users Groups ListBox.
lstUsersGroups.Clear
'Retrieve the selected user’s full name.
nResult = oMembers.GetUserFullName( _
"%NI_NT", sDomainName, lstMembers.Text)
nResult = oMembers.NextRow()
txtFullName.Text = oMembers.GetValue()
'Retrieve all groups that include the
'selected user.
nResult = oMembers.GetUserGroups( _
"%NI_NT", sDomainName, lstMembers.Text)
If nResult = 0 Then
nNumRows = oMembers.GetRowCount()
If nNumRows > 0 Then
'Place all Groups that include this user
'into the UsersGroups ListBox.
For i = 1 To nNumRows
nResult = oMembers.NextRow()
lstUsersGroups.AddItem ( _
oMembers.GetValue())
Next i
Else
lstUsersGroups.AddItem lstMembers.Text _
& " is not a member of any groups."
End If
Else
lstUsersGroups.AddItem "Unable to “ _
80 CHAPTER 3
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.