Skip to main content

Operations: Attachments: How to Get an Attachment

This operation is used to get an attachment from a document.

Syntax

public GetAttachmentOperation(string documentId, string name, AttachmentType type, string changeVector)
public class AttachmentResult
{
public Stream Stream;
public AttachmentDetails Details;
}

public class AttachmentDetails : AttachmentName
{
public string ChangeVector;
public string DocumentId;
}

public class AttachmentName
{
public string Name;
public string Hash;
public string ContentType;
public long Size;
}
Parameters
documentIdstringID of a document which will contain an attachment
namenameName of an attachment
typeAttachmentTypeDocument or Revision
changeVectorstringEntity changeVector, used for concurrency checks (null to skip check)
Return Value
StreamStream containing an attachment
ChangeVectorChange vector of an attachment
DocumentIdID of document
NameName of attachment
HashHash of attachment
ContentTypeMIME content type of an attachment
SizeSize of attachment

Example

store.Operations.Send(new GetAttachmentOperation("orders/1-A",
"invoice.pdf",
AttachmentType.Document,
changeVector: null));