|
| 1 | +# Attachments: Loading Attachments |
| 2 | +--- |
| 3 | + |
| 4 | +{NOTE: } |
| 5 | +Learn in this page how to load a part of an attachment, an entire attachment, |
| 6 | +or multiple attachments. |
| 7 | + |
| 8 | +* In this page: |
| 9 | + * [Load attachments](../../document-extensions/attachments/loading#load-attachments) |
| 10 | + * [Load a part of an attachment](../../document-extensions/attachments/loading#load-a-part-of-an-attachment) |
| 11 | + |
| 12 | +{NOTE/} |
| 13 | + |
| 14 | +--- |
| 15 | + |
| 16 | +{PANEL: Load attachments} |
| 17 | + |
| 18 | +* Use these methods to load attachments from the database. |
| 19 | + * **session.Advanced.Attachments.Get** |
| 20 | + Can be used to download an attachment or multiple attachments. |
| 21 | + * **session.Advanced.Attachments.GetNames** |
| 22 | + Can be used to download all attachment names that are attached to a document. |
| 23 | + * **session.Advanced.Attachments.GetRevision** |
| 24 | + Can be used to download an attachment of a revision document. |
| 25 | + |
| 26 | +* Use this method to verify that an attachment exists. |
| 27 | + * **session.Advanced.Attachments.Exists** |
| 28 | + |
| 29 | +## Syntax |
| 30 | + |
| 31 | +{CODE-TABS} |
| 32 | +{CODE-TAB:csharp:Sync GetSyntax@DocumentExtensions\Attachments\Attachments.cs /} |
| 33 | +{CODE-TAB:csharp:Async GetSyntaxAsync@DocumentExtensions\Attachments\Attachments.cs /} |
| 34 | +{CODE-TABS/} |
| 35 | + |
| 36 | +## Example I |
| 37 | + |
| 38 | +{CODE-TABS} |
| 39 | +{CODE-TAB:csharp:Sync GetAttachment@DocumentExtensions\Attachments\Attachments.cs /} |
| 40 | +{CODE-TAB:csharp:Async GetAttachmentAsync@DocumentExtensions\Attachments\Attachments.cs /} |
| 41 | +{CODE-TABS/} |
| 42 | + |
| 43 | +## Example II |
| 44 | +Here, we load multiple string attachments we previously created for a document. We then |
| 45 | +go through them, and decode each attachment to its original text. |
| 46 | +{CODE-TABS} |
| 47 | +{CODE-TAB:csharp:Sync GetAllAttachments@DocumentExtensions\Attachments\Attachments.cs /} |
| 48 | +{CODE-TAB:csharp:Async GetAllAttachmentsAsync@DocumentExtensions\Attachments\Attachments.cs /} |
| 49 | +{CODE-TABS/} |
| 50 | + |
| 51 | +{PANEL/} |
| 52 | + |
| 53 | +{PANEL: Load a part of an attachment} |
| 54 | + |
| 55 | +Use `GetRange` to load a part of an attachment by document ID and the attachment name. |
| 56 | + |
| 57 | +## Syntax |
| 58 | +{CODE:csharp GetRngSyntax@DocumentExtensions\Attachments\Attachments.cs /} |
| 59 | + |
| 60 | +## Sample |
| 61 | +{CODE-TABS} |
| 62 | +{CODE-TAB:csharp:Sync GetRange@DocumentExtensions\Attachments\Attachments.cs /} |
| 63 | +{CODE-TAB:csharp:Async GetRangeAsync@DocumentExtensions\Attachments\Attachments.cs /} |
| 64 | +{CODE-TABS/} |
| 65 | + |
| 66 | +{PANEL/} |
| 67 | + |
| 68 | +## Related Articles |
| 69 | + |
| 70 | +### Attachments |
| 71 | + |
| 72 | +- [What are Attachments](../../document-extensions/attachments/what-are-attachments) |
| 73 | +- [Storing](../../document-extensions/attachments/storing) |
| 74 | +- [Deleting](../../document-extensions/attachments/deleting) |
0 commit comments