Operations: Attachments: How to Put an Attachment

This operation is used to put an attachment to a document.

Syntax

public PutAttachmentOperation(string documentId, 
        string name, 
        Stream stream, 
        string contentType = null, 
        string changeVector = null)

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
documentId string ID of a document which will contain an attachment
name name Name of an attachment
stream Stream Stream contains attachment raw bytes
contentType string MIME type of attachment
changeVector string Entity changeVector, used for concurrency checks (null to skip check)
Return Value
ChangeVector Change vector of created attachment
DocumentId ID of document
Name Name of created attachment
Hash Hash of created attachment
ContentType MIME content type of attachment
Size Size of attachment

Example

AttachmentDetails attachmentDetails =
    store.Operations.Send(
        new PutAttachmentOperation("orders/1-A",
            "invoice.pdf",
            stream,
            "application/pdf"));