With the release of Content Manager 10.1, a new set of Manage-In-Place features were introduced. This allows for creating a record for an object without actually moving the file object from its source location (i.e. file system) into Content Manager. Instead, Content Manager creates a metadata only record that has a reference back to the original source document. Anytime Content Manager is to preview or download the document the Workgroup server will go to the source location to retrieve the file and return it to the requesting client interface.
In order to manage-in-place content, both a new Document Store needs to be established as well as an Origin. Version 10.1 introduces a new Document Store feature to support manage-in-place objects. This informs Content Manager that records created using this store do not get transferred to Content Manager like a traditional Document Store would. Version 10.1 also introduces a new Origin for Manage-In-Place that instructs CM to use the manage-in-place document store when creating new records. There are actually two different manage-in-place origin options introduced with 10.1, File System and XDMS (for external document management system). Let's explore the File System manage-in-place capability.
I've also included the sample powershell script. This is only an example and would require further adjustments to properly exception handle, log, etc.
#Example PowerShell script to file records from a file system to Content Manager
#Using the Manage-In-Place Origin feature available in 10.1
#Date: 05/31/2022
#Author: Patrick Johnson
#**Name of Manage-In-Place Origin to use during import
$mipName = "MiP Origin"
#**Path of file share to Manage-In-Place
$mipPath = "\\Some_File_System_Path"
#Load CM SDK and Connect to DB
Add-Type -Path "C:\Program Files\Micro Focus\Content Manager\TRIM.SDK.dll"
$database = new-object TRIM.SDK.Database;
#**Set your DBID to work in
$database.Id = "XX"
#**Set your Workgroup Server to connect to
$database.WorkgroupServerName = "localhost"
$database.Connect()
$dbName = $database.Name
Write-Host -ForegroundColor Cyan "Connected to: " $dbName
#Retrieve Manage-In-Place Origin
$mipOrigin = New-Object TRIM.SDK.Origin($database, $mipName)
Write-Host -ForegroundColor Cyan "Origin Type: " $mipOrigin.TypeOfOrigin.ToString()
if ($mipOrigin.TypeOfOrigin.ToString() -eq "GenericMip")
{
Write-Host -ForegroundColor Cyan "Origin is of type GenericMip - Processing ... "
#Returns an Origin history object for associating with any imported records in this batch
$oHistory = $mipOrigin.StartBatch($mipPath)
Get-ChildItem -File –Path $mipPath -Recurse |
Foreach-Object {
#Processing files Here...
Write-Host -ForegroundColor Green "Processing: " $_.FullName
$record = New-Object TRIM.SDK.Record($database)
$record = $mipOrigin.NewRecord($oHistory)
#Calling to trigger the origin functionality to create a new folder and allocate it to this record
$mipOrigin.AllocateContainer($mRecord)
$record.Title = $_.Name
$doc = New-Object TRIM.SDK.InputDocument
$doc.SetAsManageInPlaceItem($mipOrigin.ManageInPlaceStore, $_.FullName, $_.Length, $_.Extension, $_.LastWriteTime)
$record.SetDocument($doc, $true, $false, "Documentadded: $mipName")
$record.Save()
}
}
Else
{
Write-Host -ForegroundColor Red "Origin is not of type GenericMip - Not Processing. "
}
$database.Dispose()
Write-Host -ForegroundColor Cyan "Disconnected from: "$dbName