Share via


IListManager::CreateFromFile

Ee799355.c++_off(en-US,CS.10).gifEe799355.vb_on(en-US,CS.10).gif

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

Definition

HRESULT IListManager::CreateFromFile(BSTRlistName,BSTRlistDesc,longlFlags,longuserFlags,BSTRfileName,longerrLimit,BOOLbAsync,VARIANT*pvarOpID,VARIANT*pvarID);

Parameters

listName

[in] A BSTR that provides the name for the new list.

listDesc

[in] A BSTR that provides a description for the new list.

lFlags

[in] A long that specifies the bitmask flags that control the type of list created.

userFlags

[in] A long that contains application specific user flags. Not used by the ListManager object.

fileName

[in] A BSTR that contains the name of the file from which to create the new list.

errLimit

[in] 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

[in] A BOOL that specifies whether the creation operation is performed synchronously or asynchronously. A value of True indicates asynchronous processing.

pvarOpID

[out, optional] A pointer to a VARIANT used to return an Operation ID.

pvarID

[out, retval] A pointer to a VARIANT used to return the ID of the new list.

Return Values

This method returns an HRESULT indicating whether or not it completed successfully. See the Error Values section for more details.

Error Values

This method returns S_OK (0x00000000) to indicate success and either standard or custom COM HRESULT 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 0x8C40000A The specified file path is not valid.
E_LM_FILE_ACCESS_DENIED 0x8C400009 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 0x8C400015 The specified file does not exist.
E_LM_FILESHARE_NOT_FOUND 0x8C400016 The network share does not exist and a full path was not specified for the file.
E_LM_INVALID_FLAGS 0x8C400005 Invalid flags value.
E_LM_LIST_ALREADY_EXISTS 0x8C400007 The specified list has already been created.
E_LM_LISTPARSE_NO_GOOD_ROWS 0x8C40001B All rows in the file contained parse errors. List import failed.
E_LM_NO_GENERIC_FROM_FILE 0x8C400014 Generic lists may not be imported from files.
E_LM_OPER_CANCELED 0x8C40000B The operation was canceled.
E_LM_SQLERROR 0x8C400003 Error while executing SQL/ADO operation.
OLE_E_BLANK 0x80040007 The ListManager object has not been properly initialized.

Additional information may be available using the global Err object, which can be accessed using the API function GetErrorInfo. In particular, the GetDescription method of the IErrorInfo interface may return 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.

See Also

ListManager Object

IListManager::GetListFlags


All rights reserved.