Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Downloading loan attachments #425

Open
LarryBowen opened this issue Oct 23, 2023 · 1 comment
Open

Downloading loan attachments #425

LarryBowen opened this issue Oct 23, 2023 · 1 comment

Comments

@LarryBowen
Copy link

Can anyone please provide me with some example code to download the loan attachments? Here's the code I've got so far:

IEncompassRestClient client =
Loan loan = await client.Loans.GetLoanAsync(loanGuid);
List loanAttachments = await loan.LoanApis.Attachments.GetAttachmentsAsync();
LoanAttachment attachment = loanAttachments.;

When I call the code here:
byte[] attachmentData = await loan.LoanApis.Attachments.DownloadAttachmentAsync(attachment!.AttachmentId!);

I get the error message
EncompassRest.EncompassRestException: GetDownloadAttachmentUrlAsync: / - 400: BadRequest - CorrelationId:
{"summary":"Bad Request","details":"Error creating attachment retrieve URI: Attachment with Id is not found for loanId "}

Please, any help would be appreciated. Thanks in advance.

@tlambert
Copy link

This is what I use. We have not gone to the new document viewer which I heard you need the v3 api's and this component doesn't support it

ExportAttachmentsJob j = await loan.LoanApis.Attachments.ExportAttachmentsAsync(activeatt);
while (true)
{
if (j.Status == ExportStatus.Failed)
throw new Exception("Export Failed: " + j.Error.Summary + " -> " + j.Error.Details);
else if (j.Status == ExportStatus.Success)
break;
await j.RefreshAsync();
}
var pdfBytes = await j.DownloadAsync();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants