ListManager.CreateFromFile Method (PIA)
Use this method to create a list from a text file.
Definition
[Visual Basic .NET]
Imports Microsoft.CommerceServer.Interop.Targeting
…
Public Function CreateFromFile(listName As String,
listDesc As String,
lFlags As Integer,
userFlags As Integer,
fileName As String,
errLimit As Integer,
bAsync As Integer,
Optional ByRef pvarOpID As Object) As Object
[C#]
using Microsoft.CommerceServer.Interop.Targeting;
…
public object CreateFromFile(stringlistName,
stringlistDesc,
intlFlags,
intuserFlags,
stringfileName,
interrLimit,
intbAsync,
ref objectpvarOpID);
Parameters
[Visual Basic .NET]
- listName
A String that provides the name for the new list. - listDesc
A String that provides a description for the new list. - lFlags
An Integer that specifies the bitmask flags that control the type of list created. - userFlags
An Integer 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
An Integer 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
An Integer that specifies whether the creation operation is performed synchronously or asynchronously. A value of 1 indicates asynchronous processing. - pvarOpID
An optional Object used to return an Operation ID.
[C#]
- listName
A string that provides the name for the new list. - listDesc
A string that provides a description for the new list. - lFlags
An int that specifies the bitmask flags that control the type of list created. - userFlags
An int 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
An int 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
An int that specifies whether the creation operation is performed synchronously or asynchronously. A value of 1 indicates asynchronous processing. - pvarOpID
A reference to an object used to return an Operation ID.
Return Values
[Visual Basic .NET] If this method completes successfully, it returns an Object that contains the ID of the new list.
[C#] This method returns a reference to an object used to return the ID of the new list.
Exceptions
[Visual Basic .NET]
This method may throw one of many mapped exceptions or an exception of type COMException. See Standard COM Errors for additional details.
The following table shows the custom COM errors that a COMException can wrap.
Value | Description |
---|---|
&H8C40000A | The specified file path is not valid. |
&H8C400009 | The List Manager service does not have permission to open the specified file. Check the permissions for the List Manager service account against the permissions for the file. |
&H8C400015 | The specified file does not exist. |
&H8C400016 | The network share does not exist and a full path was not specified for the file. |
&H8C400005 | Invalid flags value. |
&H8C400007 | The specified list has already been created. |
&H8C40001B | All rows in the file contained parse errors. List import failed. |
&H8C400014 | Generic lists may not be imported from files. |
&H8C40000B | The operation was canceled. |
&H8C400003 | Error while executing SQL/ADO operation. |
&H80040007 | The ListManager object has not been properly initialized. |
[C#]
The following table shows the custom COM errors that a COMException can wrap.
Value | Description |
---|---|
0x8C40000A | The specified file path is not valid. |
0x8C400009 | The List Manager service does not have permission to open the specified file. Check the permissions for the List Manager service account against the permissions for the file. |
0x8C400015 | The specified file does not exist. |
0x8C400016 | The network share does not exist and a full path was not specified for the file. |
0x8C400005 | Invalid flags value. |
0x8C400007 | The specified list has already been created. |
0x8C40001B | All rows in the file contained parse errors. List import failed. |
0x8C400014 | Generic lists may not be imported from files. |
0x8C40000B | The operation was canceled. |
0x8C400003 | Error while executing SQL/ADO operation. |
0x80040007 | The ListManager object has not been properly initialized. |
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 ListManager 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, ListManager 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.
ListManager 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.
Example
' oListID is an Object
oListID = oListManager.CreateFromFile("TequillaBuyers1", _
"Tequilla buyers in January", 20, 0, "Tequilla.csv", 10, 0)
Requirements
Namespace: Microsoft.CommerceServer.Interop.Targeting
Platforms: Windows 2000, Windows Server 2003
Assembly: listmanagerlib (in listmanagerlib.dll)
See Also
Copyright © 2005 Microsoft Corporation.
All rights reserved.