I wanted to get some information out here for one of the more common issues we are seeing with the OLE Note Migration Utility, as well as discuss a few things I've learned about the tool over the past few months.
You may see the following error when attempting to import your OLE notes into GP using the tool.
System.AggregateException: One or more errors occurred. ---> System.InvalidOperationException: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.
The OLE Note Migration Utility will increment through your notes importing them from your export folder several at a time. It appears that when it runs into a certain number of notes that it cannot import, it will simply stop and produce the error log. The notes that have successfully imported will be deleted from your export folder and you will be left with the ones that did not import.
At this point you can just launch the import process again and you may get more or all of your remaining notes imported. My point here is that you can run the import several times in a row to try and get all of your notes over, and you will not be duplicating data. Since the over-all process will fail after so many individual file failures, I've had success in simply re-running the import a few times to get all the valid documents to import and just leave us with the files that are truly failing. You would want to do this until the success\failure numbers are consistent in the log.
Now, the most common reason for the above error is that the Note Index is missing from the SY03900 table for a significant number of your notes. We've come up with a PowerShell script that will curse through your OLE notes folder for the company and fix any missing Note Index numbers.
----------------------------------------------------------------------------------------------------
cls
#-----------Update the dir below to point to your OLENotes Folder for a specific company
$a = dir "C:\Program Files (x86)\Microsoft Dynamics\GP2010\Data\Notes\TWO\OLENotes"
function Execute-SQLNative ([string] $SQLscript, [System.Data.SqlClient.SqlConnection] $cn )
{
if ($SQLscript.EndsWith(".sql") -eq $true )
{
$SQLscript1 = Get-Content -Path $SQLscript
}
else
{
$SQLscript1 = $SQLscript
}
$SqlCmd = New-Object System.Data.SqlClient.SqlCommand
$SqlCmd.CommandText = $SQLscript1
$SqlCmd.Connection = $cn
$SqlAdapter = New-Object System.Data.SqlClient.SqlDataAdapter
$SqlAdapter.SelectCommand = $SqlCmd
$DataSet = New-Object System.Data.DataSet
$RowCount = $SqlAdapter.Fill($DataSet)
return $DataSet
}
foreach ($f in $a)
{
#------------Update the Data Source and Catalog. Database Server and Company database respectively
$i = 0
$cn = "Data Source=SQLSERVER;Initial Catalog=TWO;Integrated Security=TRUE"
$b = $f.Name.ToLower()
$c = [Convert]::ToInt32($b,16).ToString()
$c
$dt = New-Object System.Data.DataTable
$sqlstring = "SELECT TXTFIELD FROM SY03900 WHERE NOTEINDX = " + $c
$ds = Execute-SQLNative -SQLscript $sqlstring -cn $cn
$dt = $ds.Tables[0]
if ($dt.Rows.Count -eq 0)
{
$sqlstring = "insert SY03900 (NOTEINDX,DATE1,TIME1,TXTFIELD) values (" +$c + ", '2013-01-24','14:00:00','OLE Link present')"
$fake = Execute-SQLNative -SQLscript $sqlstring -cn $cn
}
}
----------------------------------------------------------------------------------------------------
You will want to update the above PowerShell script with the following:
Line 4 - The directory where you having your OLE notes stored for a specific company. This would be the original OLE notes, not the extracted files.
Line 33 - Here you will update the Data Source to be your SQL server, and the Initial Catalog to be your company database name.
You would need to run this PowerShell script for each company that you are migrating documents into. There is no harm in running this script multiple times as it will only add a Note Index for an OLE note that it finds that is missing.
You can download the GP 2013 OLE Note Migration Utility HERE!
The GP 2015 OLE Note Migration Utility should be coming soon!