question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Upload Attachment Not Associating to Document (requiring additional call)

See original GitHub issue

We are trying to use the code below to upload an attachment to a document. I believe the ASsignDocument may be an extra call. The fact that we are setting the Document / Entity Reference seems like it should be attaching it on upload. See the code sample below. The last line seems unnecessary but without it, the attachment goes into the unassigned attachment bucket.

var newAttachment = new LoanAttachment(fileInfo.Name.Replace(fileInfo.Extension, "")
               , fileInfo.Name, AttachmentCreateReason.Upload);
           newAttachment.Document = new EncompassRest.EntityReference(containerId, EncompassRest.EntityType.Document);
           var attachmentID = await apis.Attachments.UploadAttachmentAsync(newAttachment,fileData);
           await apis.Documents.AssignDocumentAttachmentsAsync(containerId, EncompassRest.AssignmentAction.Add,
               new List<EncompassRest.EntityReference>() { new EncompassRest.EntityReference(attachmentID, EncompassRest.EntityType.Attachment) });
           

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
leerodgerscommented, Oct 23, 2019

That worked!

1reaction
TylerBrinkleycommented, Oct 23, 2019

Could you try adding the following code before making your request?

attachment.ExtensionData["documentRefId"] = documentId;

If that works for you then we can add a strongly-typed DocumentRefId property to LoanAttachment.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Allow users external to organization to upload files ...
I have a file upload request in place for people out side our organization, it's open and anyone can upload but it do...
Read more >
Need the ability for external users to upload files into MS ...
However external users cannot use the upload file feature in MS Forms. ... Another big advantage is that you'll get the files associated...
Read more >
force metadata when uploading files
Hello, When I enforce values in a column in a library (in a team site), and then when uploading a file, I am...
Read more >
Re: Adobe Sign Send with Attachments/Supporting Do...
I have tried text tags with prefill options and I have tried the 'add files' option when setting up for signature, but all...
Read more >
How the heck do I attach a file to a record via a Site Guest ...
For example, you would need to first create the record, keep it accessible to the site guest user, allow the file upload to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found