IBProcessEmail.Documents

Syntax

Documents: IBProcessEmailDocuments;

Description

The Documents property determines the collection of documents attached to email.

Example

Executing the example requires that the repository contains a process with the PROCESS identifier. A start event is set for the process, which sends an email with attached documents.

Add links to the BPM, Metabase system assemblies. Add a link to the assembly that is required to work with processes.

Sub UserProc;
Var
    Mb: IMetabase;
    MObj: IMetabaseObjectDescriptor;
    Process: IBProcess;
    EventCollection: IBProcessEventGroupCollection;
    EMailEvent: IBProcessEventEmail;
    Email: IBProcessEmail;
    Docs: IBProcessEmailDocuments;
    Doc: IBProcessEmailDocument;
    i, c: Integer;
Begin
    Mb := MetabaseClass.Active;
    MObj := Mb.ItemById("PROCESS");
    // Get process structure
    Process := BProcessCollection.ByKey(MObj.Key);
    // Get the collection of groups of process events
    EventCollection := Process.Events;
    EMailEvent := EventCollection.ItemByType(BProcessEventType.StartProcess).Item(0As IBProcessEventEmail;
    Email := EMailEvent.Email;
    // Documents attached to email
    Docs := Email.Documents;
    c := Docs.Count;
    Debug.WriteLine("Number of documents: " + c.ToString);
    For i := 0 To c - 1 Do
        Doc := Docs.Item(i);
        Debug.WriteLine("Document: " + Doc.Name + "( Key: " + Doc.Key.ToString + ')');
        Debug.Indent;
        Debug.WriteLine("Document type: " + Doc.DocType);
        Debug.WriteLine("Document in repository: " + Doc.Descriptor.Name + '(' + Doc.Descriptor.Id + ')');
        Debug.Unindent;
    End For;
End Sub UserProc;

After executing the example the development environment console window displays information about documents attached to the email.

See also:

IBProcessEmail