IListManager::CreateFromFile Method [C++]

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

Definition

[C++]

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

[Visual Basic]

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[C++]
    [in] A BSTR that provides the name for the new list.
  • listName[Visual Basic]
    A String that provides the name for the new list.
  • listDesc[C++]
    [in] A BSTR that provides a description for the new list.
  • listDesc[Visual Basic]
    A String that provides a description for the new list.
  • lFlags[C++]
    [in] A long that specifies the bitmask flags that control the type of list created.
  • lFlags[Visual Basic]
    A Long that specifies the bitmask flags that control the type of list created.
  • userFlags[C++]
    [in] A long that contains application specific user flags. Not used by the ListManager object.
  • userFlags[Visual Basic]
    A Long that contains application specific user flags. Not used by the ListManager object.
  • fileName[C++]
    [in] A BSTR that contains the name of the file from which to create the new list.
  • fileName[Visual Basic]
    A String that contains the name of the file from which to create the new list.
  • errLimit[C++]
    [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).
  • errLimit[Visual Basic]
    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[C++]
    [in] A BOOL that specifies whether the creation operation is performed synchronously or asynchronously. A value of True indicates asynchronous processing.
  • bAsync[Visual Basic]
    A Boolean that specifies whether the creation operation is performed synchronously or asynchronously. A value of True indicates asynchronous processing.
  • pvarOpID[C++]
    [out, optional] A pointer to a VARIANT used to return an Operation ID.
  • pvarOpID[Visual Basic]
    An optional Variant used to return an Operation ID.
  • pvarID[C++]
    [out, retval] A pointer to a VARIANT used to return the ID of the new list.

Return Values

[C++] This method returns an HRESULT indicating whether it completed successfully. See the Error Values section for more details.

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

Error Values

[C++] 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.

[Visual Basic] 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 [C++] 0x8C40000A

[Visual Basic] &H8C40000A

The specified file path is not valid.
E_LM_FILE_ACCESS_DENIED [C++] 0x8C400009

[Visual Basic] &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 [C++] 0x8C400015

[Visual Basic] &H8C400015

The specified file does not exist.
E_LM_FILESHARE_NOT_FOUND [C++] 0x8C400016

[Visual Basic] &H8C400016

The network share does not exist and a full path was not specified for the file.
E_LM_INVALID_FLAGS [C++] 0x8C400005

[Visual Basic] &H8C400005

Invalid flags value.
E_LM_LIST_ALREADY_EXISTS [C++] 0x8C400007

[Visual Basic] &H8C400007

The specified list has already been created.
E_LM_LISTPARSE_NO_GOOD_ROWS [C++] 0x8C40001B

[Visual Basic] &H8C40001B

All rows in the file contained parse errors. List import failed.
E_LM_NO_GENERIC_FROM_FILE [C++] 0x8C400014

[Visual Basic] &H8C400014

Generic lists may not be imported from files.
E_LM_OPER_CANCELED [C++] 0x8C40000B

[Visual Basic] &H8C40000B

The operation was canceled.
E_LM_SQLERROR [C++] 0x8C400003

[Visual Basic] &H8C400003

Error while executing SQL/ADO operation.
OLE_E_BLANK [C++] 0x80040007

[Visual Basic] &H80040007

The ListManager object has not been properly initialized.

[C++] 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.

[Visual Basic] 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.

[Visual Basic]

Example

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

See Also

[C++]ListManager Object

[Visual Basic]ListManager Object

[C++]IListManager::GetListFlags

[Visual Basic]ListManager.GetListFlags

Copyright © 2005 Microsoft Corporation.
All rights reserved.