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

Question

Question

BriefcaseExport Warning Messages

SDK
asked on May 9, 2022

Is there a way to get at the warning messages logged for a briefcase export? I'm working on a migration project from a repository that's been around for years, and a number of pages have gone missing. If I export the briefcase from the Client, an error gets logged in the Event Viewer that then leads me to a log file with a bit more info. The briefcase actually does get created successfully, just missing the pages in question.

Using Workflow to replicate the entry doesn't lead to any warning messages so I am looking to do it via SDK (among other reasons).

Is there any easy way to get at these warning messages via SDK? BriefcaseImporter has a GetAllExceptions method that does something similar, but my imports for this situation don't lead to any warnings or anything, just the export side.

0 0

Answer

APPROVED ANSWER
replied on May 10, 2022

You can get the briefcase export log by calling GetLogFile() on the LongOperation object.

2 0
replied on May 10, 2022

Minor update on this. The HasLog check always evaluates to TRUE, but the GetLogFile() throws a "system cannot find the file specified" when it's not actually there.

Since all my IF logic attempts failed me, I threw things into a try-catch to get at the logs without issues (I'm a bit of a n00b, though, so there might be a cleaner way that I'm missing). 

0 0
replied on May 10, 2022

That's unfortunate, are you saying that GetLogFile() always throws that error?

The try/catch method is a good solution, something like this:

LongOperation briefcaseExportOperation = DoExport();
string tempLogPath = Path.GetTempFileName();

try
{
    using (Stream logStream = briefcaseExportOperation.GetLogFile())
    using (Stream fileStream = File.OpenWrite(tempLogPath))
    {
        logStream.CopyTo(fileStream);
    }
}
catch (Exception ex)
{
    // Log the exception here
}

 

0 0
replied on May 11, 2022

If there's a log file it works fine, the issue is if there isn't one. Things like checking if the GetLogFile() is null or length > 0 or just writing to file all lead to that error when the file doesn't exist when there were no warnings, even though HasLog evaluates to true.

Luckily, I just need to figure out the capabilities and then I can turn it over to a developer that I work with to write good code.

FWIW I'm using SDK 10.2 so maybe it's better in 11? Though for this project I'll actually need to downgrade to RA 9.1

0 0

Replies

replied on May 9, 2022

Tagging in @████████  in case you have ideas

0 0
replied on May 9, 2022

Not offhand. @████████

?

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

Sign in to reply to this post.