Finding documents by ID

Finding documents by ID
 1# This example finds a document in the active database with a specific ID
 2
 3ot = impact.gui.output_toolbox
 4ot.clear()
 5
 6db = impact.active_database
 7
 8# You can search for a document ID or document series ID
 9# When seaching for a document series ID the latest document version is returned
10document_id = "e1b1ad95-f9de-40c0-9d08-0fee87e8a011"
11
12# Find the document
13document = db.find_document_by_id(document_id)
14
15# Check the document was found
16if not document.isNone():
17
18    # Display a message in the output toolbox
19    ot.add("Found the document")
20
21    # Display the name of the document in the output toolbox
22    ot.add("Name: " + str(document.name))
23
24else:
25
26    # Display a message in the output toolbox
27    ot.add("Unable to find the document with ID '" + str(document_id) + "'")
28