CreateSection

CAS ActiveX Methods
The CreateSection method creates a new section within a taglist, and adds the first tag to that section.  The first tag in a section designates the purpose for the section, and is significant later on when calling the OpenSection and GetSectionCount methods that search for sections that begin with a specific tag.  The handle returned from CreateSection can be passed to the AddTag and CloseSection methods.

Certain CAS functions require that the input taglist is organized using sections.  For example, the SEND_MESSAGE function requires that recipient addresses and message content are provided in RECEIVER_ADDRESS and CONTENT_PART sections (see example below).  Taglist sections that start with tags that are unexpected by a function are ignored.

Taglist reading methods, such as GetTag will fail while a section is open, because the total size of a section is undefined until CloseSection is called.  Because taglists grow sequentially, once a section has been closed, no more tags or sections can be added to the closed section.

LONG CreateSection(
  LONG TagList, // Taglist to have section added
  BSTR TagName, // First tag to add to new section
  BSTR TagData // Data for tag that is added
)


Parameters:
TagList Taglist to have section added.

TagName First tag to add to new section.

TagData Data for Tag to be added.

Return Values:
Taglist, which is a section to another taglist.  You must pass this taglist to CloseSection when you are done adding tags and/or more sections to it.

0x0000 =
Unable to create section.

Example:
function SendFaxAttachments()
  {
  var Tl, StatusNum;
  
  Tl = CAS.New();
  CAS.AddTag(Tl,"SEND_MESSAGE","");
  CAS.AddTag(Tl,"REGISTERED_NAME",UserName);
  CAS.AddTag(Tl,"REGISTERED_PASSWORD",UserPassword);
  CAS.AddTag(Tl,"TRANSFER_TYPE",0);  // 1= EMAIL, 0=FAX
  CAS.AddTag(Tl,"SUBJECT","Subject");

  Sl = CAS.CreateSection(Tl,"RECEIVER_ADDRESS","555-123-1234");
    CAS.AddTag(Sl,"RECEIVER_NAME","Recipient");
  CAS.CloseSection(Sl);
  
    // Send an ASCII cover message

  Sl = CAS.CreateSection(Tl,"CONTENT_PART",2);
    CAS.AddTag(Sl,"CONTENT_TYPE",1);
    CAS.AddTag(Sl,"CONTENT_DATA","This is my cover text!");
  CAS.CloseSection(Sl);

    // Send a web page by referencing a URL.  The CONTENT_TYPE
    // is set to HTML, but COPY_ATTACHMENT is 0 so the
    // CURRENT_FILESPEC is treated as a URL, not a file name.

  Sl = CAS.CreateSection(Tl,"CONTENT_PART",3);
    CAS.AddTag(Sl,"CONTENT_TYPE",12);
    CAS.AddTag(Sl,"ORIGINAL_FILENAME","anything.html");
    CAS.AddTag(Sl,"CURRENT_FILESPEC", "http://www.faxback.com");
    CAS.AddTag(Sl,"COPY_ATTACHMENT",0);
  CAS.CloseSection(Sl);

    // Send a Word .DOC file

  Sl = CAS.CreateSection(Tl,"CONTENT_PART",3);
    CAS.AddTag(Sl,"CONTENT_TYPE",0);
    CAS.AddTag(Sl,"ORIGINAL_FILENAME","TestFile.doc");
    CAS.AddTag(Sl,"CURRENT_FILESPEC", "c:\\temp\\TestFile.doc");
    CAS.AddTag(Sl,"COPY_ATTACHMENT",1);
  CAS.CloseSection(Sl);

    // Send message on this already open session
  Tl = CAS.Send(cInst,Tl);
  StatusNum = parseInt(CAS.GetTag(Tl,"STATUS_NUM",0));
  CAS.Delete(Tl);
  
  return(StatusNum);
  }

See Also:
CAS New, CAS OpenSection, CAS CloseSection, CAS AddTag