Skip to main content

Session: How to Check if an Attachment Exists

  • To check whether a document contains a certain attachment, use the method Exists() from the session.Advanced.Attachments operations.

  • This does not load the document or the attachment from the server, and it does not cause the session to track the document.

  • In this page:

Syntax

bool Exists(string documentId, string name);
ParameterTypeDescription
documentIdstringThe ID of the document you want to check for the attachment
namestringThe name of the attachment you want to check the document for
Return ValueDescription
boolIndicates whether the document has an attachment with the specified name

Example

bool exists = session
.Advanced
.Attachments
.Exists("categories/1-A","image.jpg");

if (exists)
{
//do something
}