Function EN Version 5.00

@CreateAttachmentFromBuffer

Attachments Note

Syntax

@CreateAttachmentFromBuffer(NOTEHANDLE;BINBUFFER;FNOPTIONS;TEXTNAME);

Description

Creates from the content of the BINBUFFER BINBUFFER an attachment with the (internal) name TEXT TEXTNAME in the document with the NOTEHANDLE NOTEHANDLE.

FN FNOPTIONS:
0   None
1   Overwrite a possibly existing attachment with the same internal name TEXT TEXTNAME

Return value of the function: TRUE if the attachment could be created successfully; otherwise @Error is returned.

Example: @CreateAttachmentFromBuffer(NOTEHANDLE;BINBUFFER;FNOPTIONS;TEXTNAME)

DestDBPath:="test.nsf";
DestDBh:=@OpenDB(DestDBPath);

DestNoteh:=@CreateNote(DestDBh;DestNoteh);
Form[DestNoteh]:="Testform";
AttachmentText:="Test content for the newly created attachment!";
AttachmentTextLen:=@Length(AttachmentText);

BinBuffer:=@CreateBuffer(AttachmentText);
@WriteBuffer(BinBuffer;AttachmentText);
Ret:=@CreateAttachmentFromBuffer(DestNoteh;BinBuffer;1;"test.txt");
@LogReport(Ret);
BinBuffer:=@DestroyBuffer(BinBuffer);

DestNoteh:=@CloseNote(DestNoteh;1);
DestDBh:=@CloseDB(DestDBh);

A DB is opened and a new document with the NOTEHANDLE DestNoteh is created.
A BINBUFFER BinBuffer is created and the content for the attachment to be created is written into the BINBUFFER BinBuffer.
An attachment is then created from this BinBuffer and appended to the newly created document with the NOTEHANDLE DestNoteh.
Finally, the document is written and the DB is closed again.

Note : This text was machine-translated and may contain inaccuracies.