Adding a Word Explorer to Webdrawer

I've always wanted to see the words related to a search I've performed.  I know many others like that concept as well, especially when they aren't quite sure what they need, are conducting a legal hold search, or otherwise are just curious about their results.  Without any real "requirements", I set out to create something new for webdrawer.... feedback is welcome!

First, notice my search results page now has a search explorer pane displayed to the right:

2017-09-12_16-07-05.png

Clicking one of those words filters out all records except those containing the clicked word.

2017-09-12_16-07-05.png

This feature is both easy to use and easy to add to your Webdrawer.  I didn't bother really building out this functionality the way I'd truly like it to exist, but it highlights the flexibility of Webdrawer itself.  Ideally the search explorer pane would allow the user to narrow to a specific word (like it does now), exclude records using that word, and explore words in custom properties.  All of that is easily possible with the latest design of Webdrawer.

Creating a Workflow Report and Placing into Default Container

Someone asked if you could use powershell to generate a workflow status report and save it into the workflow's default container..... yes you can!

Add-Type -Path "D:\Program Files\Hewlett Packard Enterprise\Content Manager\HP.HPTRIM.SDK.dll"
$iseProc = Get-Process -id $pid
$db = New-Object HP.HPTRIM.SDK.Database
$wfs = New-Object HP.HPTRIM.SDK.TrimMainObjectSearch -ArgumentList $db, Workflow
$wfs.SearchString = "all"
$report = New-Object HP.HPTRIM.SDK.Report -ArgumentList $db, "Workflow Report"
$docRt = New-Object HP.HPTRIM.SDK.RecordType -ArgumentList $db, "Document"
foreach ( $wf in $wfs ) 
{
    if ( ([HP.HPTRIM.SDK.Workflow]$wf).DefaultContainer -ne $null ) 
    { 
        $wfc = New-Obect HP.HPTRIM.SDK.TrimMainObjectSearch -ArgumentList $db, Workflow
        $wfc.SearchString = "uri:$(([HP.HPTRIM.SDK.Workflow]$wf).Uri)"
        $pdf = $report.PrintReportToPdf($wfc)
        $pdfRec = New-Object HP.HPTRIM.SDK.Record -ArgumentList $db, $docRt
        $pdfRec.TypedTitle = "Workflow Report"
        $pdfRec.SetDocument($pdf)
        $pdfRec.SetContainer(([HP.HPTRIM.SDK.Workflow]$wf).DefaultContainer)
        $pdfRec.Save()
        $pdfRec.Dispose()
    }
}
$db.Dispose()

Calculating Total Size (Bytes) used by Record Types

Someone on the forums posted a question about how to calculate total volume by record type.  Given that there is little capability to gather this information from the client, I figured I'd share my powershell script.  It's included below!  

Add-Type -Path "D:\Program Files\Hewlett Packard Enterprise\Content Manager\HP.HPTRIM.SDK.dll"
Add-Type -Path "D:\Program Files\Hewlett Packard Enterprise\Content Manager\HP.HPTRIM.Framework.dll"
$iseProc = Get-Process -id $pid
$db = New-Object HP.HPTRIM.SDK.Database
$rtSearch = New-Object HP.HPTRIM.SDK.TrimMainObjectSearch -ArgumentList $db, RecordType
$rtSearch.SearchString = "all"
$rtSearch = [HP.HPTRIM.SDK.ObjectSelector]::SelectMany($iseProc.MainWindowHandle, $rtSearch)
foreach ( $rt in $rtSearch ) 
{
    [long]$totalBytes = 0
    [long]$curRec = 0
    $recs = New-Object HP.HPTRIM.SDK.TrimMainObjectSearch -ArgumentList $db, Record
    $recs.SearchString = "type:$($rt.Uri)"
    foreach ( $rec in $recs ) 
    {
        $curRec++
        Write-Progress -Activity "Inspecting $(([HP.HPTRIM.SDK.RecordType]$rt).Name)" -status "Record $($curRec)" -PercentComplete (($curRec/$recs.Count)*100)
        $totalBytes += ([HP.HPTRIM.SDK.Record]$rec).DocumentSize
        foreach ($rendition in $rec.ChildRenditions) {
            $totalBytes += ([HP.HPTRIM.SDK.RecordRendition]$rendition).Bytes
        }
        foreach ($revision in $rec.ChildRevisions ) {
            $totalBytes += ([HP.HPTRIM.SDK.RecordRevision]$revision).Bytes
        }
    }
    Write-Host "$(([HP.HPTRIM.SDK.RecordType]$rt).Name) Total Size: $($totalBytes)"
	$recs.Dispose()
}
$rtSearch.Dispose()
$db.Dispose()

When you run the powershell script you'll first be prompted to select the record type(s) you want to inspect.  You can either highlight one individual record type, tag multiples, or hit cancel.  If you've selected a record type the script will iterate each sequentially and inspect the electronic object, any renditions, and all revisions.

2017-09-11_18-27-04.png

A handy progress bar will indicate the progress through each record type....

2017-09-11_18-27-04.png

Once it's all done with the calculations you'll see the output in the window...

2017-09-11_18-27-04.png