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

Question

Question

How to use the Briefcase API

asked on December 11, 2018 Show version history

Hi there,

I'd like to use the briefcase API to move every document and folder from one repository to another. I don't get any errors but nothing is transferred either.

I've used other code to replicate users and groups. 

There aren't any External Tables (but feel free to include code for that).

    Private Function fnReplicateFolders() As Long
        Dim oBCExp As New BriefcaseExporter(m_oSourceSession)
        Dim oBCImp As New BriefcaseImporter(m_oDestSession)
        Dim oEntryInfo As EntryInfo = Entry.GetEntryInfo(1, m_oDestSession)
        Dim oMemStream As System.IO.Stream

        oBCExp.BriefcaseName = "all-the-things"
        'oBCExp.CompressionLevel = 9
        oBCExp.IncludeVersionHistory = False
        oBCExp.PreserveFolderStructure = True
        oBCExp.AddEntry(oEntryInfo, BriefcaseSourceOptions.RecurseFolders)
        oMemStream = oBCExp.Export()

        oMemStream.Flush()
        oMemStream.Seek(0, 0)
        oBCImp.DestinationFolder = Folder.GetRootFolder(m_oDestSession)
        oBCImp.Import(oMemStream)

        Return 0 'oMemStream.Length
    End Function

 

-Ben

 

0 0

Answer

SELECTED ANSWER
replied on December 14, 2018 Show version history

You are just missing setting the importer stream mode equal to True

    Private Function fnReplicateFolders(ByVal SourceID As Integer, ByVal DestID As Integer) As Long
        Dim oBCExp As New BriefcaseExporter(RASession)
        Dim oBCImp As BriefcaseImporter
        Dim oEntryInfo As EntryInfo = Entry.GetEntryInfo(SourceID, RASession)
        Dim oMemStream As System.IO.Stream

        oBCExp.BriefcaseName = "all-the-things"
        oBCExp.IncludeVersionHistory = False
        oBCExp.PreserveFolderStructure = True
        oBCExp.AddEntry(oEntryInfo, BriefcaseSourceOptions.RecurseFolders)
        oMemStream = oBCExp.Export()
        oBCImp = New BriefcaseImporter(Folder.GetFolderInfo(DestID, RASession), Volume.GetInfo("DEFAULT", RASession), RASession)
        oBCImp.Stream = True
        oBCImp.Import(oMemStream)
        Return 0 'oMemStream.Length
    End Function

Note:  my function just exports and imports using the same Session object

Also, you probably need to dispose of the stream object after you are done importing.

1 0
replied on December 17, 2018

Thanks Bert,

oBCImp.Stream = True

Was the missing piece!

-Ben

 

0 0

Replies

replied on December 13, 2018

I can't delete this because someone is watching it but I found a post by Bert that might have what I'm missing.

https://answers.laserfiche.com/questions/61273/How-can-make-the-Matching-Templates-and-Fields-in-Briefcase-Importer-using-DSK-Net-v9#61289

 

1 0
replied on December 13, 2018

Ben

I don't know if the bug reported in RA Breifcase export was ever resolved, but something to watch for if you are creating large briefcase files.

0 0
replied on December 13, 2018

Hi Bert,

Funny you say that. My issue is exporting to a memory stream. Of any size. Have you any experience in that?

See you in Feb?

-Ben

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

Sign in to reply to this post.