L
lewie
Option Explicit On
Imports System.IO
Imports System.Web.Mail
Imports System.Configuration
Module Module1
' This constant is not included in the CDO (1.x) type library,
' so you must declare it explicitly or use the provided
' value directly.
Private Const CdoPR_EMS_AB_PROXY_ADDRESSES = &H800F101E
Private Const Delimiter = ";"
Sub Main()
Dim objSession As MAPI.Session
Dim objAddressLists As MAPI.AddressLists
Dim objField As MAPI.Field
On Error GoTo ET1
' Create Session object and Logon.
objSession = CreateObject("MAPI.Session")
'objSession.Logon()
objSession.Logon("lewis.k", "", False, True )
objAddressLists = objSession.AddressLists
Dim objGal As MAPI.AddressList = objAddressLists.Item("Global
Address List")
Dim nextlist As String
Dim distributions As New Hashtable
Dim addressess As New DataTable
Dim colName As New DataColumn
colName.ColumnName = "Name"
colName.DataType = System.Type.GetType("System.String")
colName.AllowDBNull = False
colName.Caption = "Name"
addressess.Columns.Add(colName)
Dim colEmail As New DataColumn
colEmail.ColumnName = "Email"
colEmail.DataType = System.Type.GetType("System.String")
colEmail.AllowDBNull = False
colEmail.Caption = "Email"
addressess.Columns.Add(colEmail)
' TO DO Loop through input file
Dim objReader As StreamReader = New
StreamReader(ConfigurationSettings.AppSettings("WorkingPath") +
"\Input\" + "Input1.txt")
nextlist = objReader.ReadLine
While nextlist > ""
Recurse(objGal, addressess, distributions, nextlist)
Dim file_name As String =
ConfigurationSettings.AppSettings("WorkingPath") + "\Output\" +
nextlist
Dim stream_writer As New IO.StreamWriter(file_name, False)
addressess.DefaultView.Sort = "Name"
stream_writer.WriteLine("this file has " +
Str(addressess.Rows.Count) + " rows")
For Each dr As System.Data.DataRowView In
addressess.DefaultView
stream_writer.Write(dr("Name"))
stream_writer.Write(
this is the declaration part
Thanks
Lewie
Imports System.IO
Imports System.Web.Mail
Imports System.Configuration
Module Module1
' This constant is not included in the CDO (1.x) type library,
' so you must declare it explicitly or use the provided
' value directly.
Private Const CdoPR_EMS_AB_PROXY_ADDRESSES = &H800F101E
Private Const Delimiter = ";"
Sub Main()
Dim objSession As MAPI.Session
Dim objAddressLists As MAPI.AddressLists
Dim objField As MAPI.Field
On Error GoTo ET1
' Create Session object and Logon.
objSession = CreateObject("MAPI.Session")
'objSession.Logon()
objSession.Logon("lewis.k", "", False, True )
objAddressLists = objSession.AddressLists
Dim objGal As MAPI.AddressList = objAddressLists.Item("Global
Address List")
Dim nextlist As String
Dim distributions As New Hashtable
Dim addressess As New DataTable
Dim colName As New DataColumn
colName.ColumnName = "Name"
colName.DataType = System.Type.GetType("System.String")
colName.AllowDBNull = False
colName.Caption = "Name"
addressess.Columns.Add(colName)
Dim colEmail As New DataColumn
colEmail.ColumnName = "Email"
colEmail.DataType = System.Type.GetType("System.String")
colEmail.AllowDBNull = False
colEmail.Caption = "Email"
addressess.Columns.Add(colEmail)
' TO DO Loop through input file
Dim objReader As StreamReader = New
StreamReader(ConfigurationSettings.AppSettings("WorkingPath") +
"\Input\" + "Input1.txt")
nextlist = objReader.ReadLine
While nextlist > ""
Recurse(objGal, addressess, distributions, nextlist)
Dim file_name As String =
ConfigurationSettings.AppSettings("WorkingPath") + "\Output\" +
nextlist
Dim stream_writer As New IO.StreamWriter(file_name, False)
addressess.DefaultView.Sort = "Name"
stream_writer.WriteLine("this file has " +
Str(addressess.Rows.Count) + " rows")
For Each dr As System.Data.DataRowView In
addressess.DefaultView
stream_writer.Write(dr("Name"))
stream_writer.Write(
this is the declaration part
Thanks
Lewie