ListManager.CreateFromFile

Ee784635.c++_on(en-US,CS.10).gifEe784635.vb_off(en-US,CS.10).gif

Use this method to create a list from a text file.

Definition

Function CreateFromFile(listName As String,listDesc As String,lFlags As Long,userFlags As Long,fileName As String,errLimit As Long,bAsync As Boolean,Optional pvarOpID As Variant) As Variant

Parameters

listName

A String that provides the name for the new list.

listDesc

A String that provides a description for the new list.

lFlags

A Long that specifies the bitmask flags that control the type of list created.

userFlags

A Long that contains application specific user flags. Not used by the ListManager object.

fileName

A String that contains the name of the file from which to create the new list.

errLimit

A Long that specifies the maximum number of errors allowed before the operation is terminated. To specify no limit, set the errLimit parameter to zero (0).

bAsync

A Boolean that specifies whether the creation operation is performed synchronously or asynchronously. A value of True indicates asynchronous processing.

pvarOpID

An optional Variant used to return an Operation ID.

Return Values

If this method completes successfully, it returns a Variant that contains the ID of the new list.

Error Values

This method sets the Number property of the global Err object to S_OK (&H00000000) to indicate success and to either standard or custom COM error values to indicate failure. For more information about standard COM errors, see Standard COM Errors.

The following table shows the custom COM errors, and the standard COM errors with special meanings, that this method can return.

Constant Value Description
E_LM_BAD_FILE_PATH &H8C40000A The specified file path is not valid.
E_LM_FILE_ACCESS_DENIED &H8C400009 The ListManager service does not have permission to open the specified file.Check the permissions for the ListManager service account against the permissions for the file.
E_LM_FILE_NOT_FOUND &H8C400015 The specified file does not exist.
E_LM_FILESHARE_NOT_FOUND &H8C400016 The network share does not exist and a full path was not specified for the file.
E_LM_INVALID_FLAGS &H8C400005 Invalid flags value.
E_LM_LIST_ALREADY_EXISTS &H8C400007 The specified list has already been created.
E_LM_LISTPARSE_NO_GOOD_ROWS &H8C40001B All rows in the file contained parse errors. List import failed.
E_LM_NO_GENERIC_FROM_FILE &H8C400014 Generic lists may not be imported from files.
E_LM_OPER_CANCELED &H8C40000B The operation was canceled.
E_LM_SQLERROR &H8C400003 Error while executing SQL/ADO operation.
OLE_E_BLANK &H80040007 The ListManager object has not been properly initialized.

Additional information may be available using the global Err object. In particular, the Description property may contain a text description of the error.

Remarks

If a list with the same name as the listName parameter already exists, the method fails. Lists imported from text files may not be generic lists; they are always mailing lists.

The user account that the List Manager is configured to run under must have permission to access the file. For example, if the file is on a network share, the service must be running under a domain account or must otherwise have permission to access the share.

If an absolute file path and name is not specified, List Manager will look for the file relative to a root folder named CommerceLists on the local computer running the List Manager service. If the folder does not exist, an error is returned.

List Manager recognizes the following input text file format:

   <Mail-to address>,<User ID>,<Message Format>,<Locale>,
   <Source URL><cr><lf>

Mail-to address is the only required field. The Message Format field should be one of the following: 1 = text, 2 = mime, or 3 = mhtml. The Message Format, Locale, and Source fields are provided for use with Direct Mailer.

Any of the fields may be enclosed in double quotation marks. This is required if the value in the field contains any comma or double quotation mark characters. Two double quotation marks together within a quoted field can be used to denote a double quotation mark. A trailing comma will produce an error.

For a list of possible values for the lflags parameter, see the GetListFlags method.

Rows with duplicate e-mail addresses in the file are ignored.

The parameter, pvarOpID, contains valid data only if the creation operation is performed asynchronously.

For more information about memory ownership issues related to COM property and method parameters, see Managing COM Parameter Memory.

Example

' vListID is a Variant
vListID = oListManager.CreateFromFile("TequillaBuyers1", _
 "Tequilla buyers in January", 20, 0, "Tequilla.csv", 10, False)

See Also

ListManager Object


All rights reserved.