You are viewing limited content. For full access, please sign in.

Question

Question

SDK Document Export Path Limit

asked on June 3

I am trying to export documents from an On-Premise repository to Windows, maintaining the LF folder structure in Windows. This works great with an SDK script within a workflow except when the resulting path in Windows is too long, in which case no document is exported.

Is there a way to do this? I have tried:

1) Mapping one of the subfolders to a drive letter in Windows and exporting to that instead

2) Editing the registry to allow long paths in Windows

3) Putting \\?\ at the beginning of the export path

 

I unfortunately cannot shorten the Windows path any more than I have already.

0 0

Answer

SELECTED ANSWER
replied on June 3 Show version history

This is working for me, but any documents in a path longer than the 260 cannot be directly opened in Windows.

 

First off, I have the following function in my WF SDK Script


        Private Function WindowsFullPath(ByVal sPath As String) As String
            Dim sReturn As String = Nothing
            If sPath.Length > 255 Then
                sReturn = "\\?\" & sPath
            Else
                sReturn = sPath
            End If
            Return sReturn
        End Function

Then in the script, before exporting, I ensure that the Windows folder Exists

Dim di As System.IO.DirectoryInfo = New System.IO.DirectoryInfo(WindowsFullPath(sExportFolder))
If Not di.Exists Then
    di.Create()
End If

Then I create the Full Export Path with the document name and then export

Dim exportPath As String = WindowsFullPath(System.IO.Path.Combine(sExportFolder, WindowsFileName(LFDoc.Name) + "." + LFDoc.Extension))
docExporter.ExportElecDoc(LFDoc, exportPath)

Note:  The "WindowsFileName" function replaces any Windows illegal characters with underscore (_).

 

Also, I had to enable Long Paths in the registry

1 0
replied on June 4

Thank you Bert! I was able to integrate parts of this into my code and things are working now

0 0

Replies

replied on June 3

Brian,

Unfortunately that 260 character path length issue is an OS issue.  You can enable the Windows long paths option by editing the registry as you mention but legacy apps can still be limited to the 260 character limit.

In the past when we have engineered migrations from Laserfiche to other ECM solutions using the SDK we have been forced to get creative with the path and file names in Laserfiche.

One option I haven't explored is using the Laserfiche API instead of the SDK to export documents out of the repository.  Just a thought.

2 0
You are not allowed to follow up in this post.

Sign in to reply to this post.