Populating Containers in Asynchronous Mode

The SmsPopulate function can retrieve folders in asynchronous mode from containers that contain machine folders (site containers, site group containers, machine containers, and machine group containers). Using asynchronous mode, your application goes immediately to the next line of code (after the SmsPopulate call) while the SMS API engine retrieves all folders that satisfy the filter criteria. You can set additional flags that specify that the SMS API engine should set an event handle or post a message to a window each time a specified number of objects is retrieved and when the retrieval is completed.

Although the SmsPopulate function applies to containers, the asynchronous behavior goes into effect only when retrieving machine folders from their parent containers or folders. For machine containers, the asynchronous behavior is in effect when SmsPopulate is called, because machine folders are the top-level folder in the container.

However, the machine folders in a site container are lower-level folders; they are contained within the domain folders within site folders. When your application uses asynchronous population on a site container, the asynchronous retrieval takes effect when it accesses the folder containing the machine folders—the domain folder. The site folders and the domain folders are not retrieved asynchronously.

When your application uses asynchronous mode to retrieve machine folders within a site container, you must consider the following issues:

To start asynchronous retrieval of the machine folders in a domain folder, the domain folder must be initialized.
Asynchronous retrieval in a site container begins only after the domain folder is initialized. This initialization does not occur when the domain folder is retrieved. The initialization is triggered by calling one of the following functions:

SmsGetFolderByID

SmsGetFolderCount

SmsGetNextFolder

SmsGetNextScalar

SmsGetScalarByName

SmsGetScalarCount

SmsSetScalar

For example, if a site folder contains four domain folders and your application calls one of the listed functions (such as SmsGetFolderCount) for only one domain folder, machine folder retrieval will be triggered only for that one domain.

Only one event handle (or window handle) is used for notification for all domain folders in a site container.
If your application triggers the retrieval for more than one domain folder, all the domain folders will use the single handle to signal the event. This means that your application cannot determine which domain folder has set the signaled state by using only the state of the event.

To avoid problems, your application should use one of the following methods to retrieve machine folders from multiple domain folders:

Sequential Processing of Domain Folders
Retrieves machine folders for domain folders sequentially by initializing each domain folder one at a time and allowing the retrieval for the domain folder to complete before initializing the next domain folder.
Processing Multiple Domain Folders Simultaneously
Retrieves machine folders for multiple domain folders at the same time.