Я пытаюсь отобразить список электронных писем здесь, и я хочу использовать мой метод List, чтобы заменить Arraylist из моего метода.
Метод, который отображает список электронных писем
public static List<Item> GetEmail(string rootUR)
{
ExchangeService exchangeService = new ExchangeService();
//exchangeService.Credentials = new NetworkCredential("$svclhappitg003", "lot.lid-37", "auth");
//exchangeService.Credentials = new NetworkCredential("$svclhappitge001", "art.bat-43", "americas"); //ITG
//exchangeService.Credentials = new NetworkCredential("$svclhappe001", "two.bit-76", "americas"); //PROD
ExchangeService exchangeService1 = exchangeService;
try
{
exchangeService1.AutodiscoverUrl(rootUR);
}
catch (Exception exception)
{
exception.ToString();
}
FolderId folderId = new FolderId(WellKnownFolderName.Inbox, new Mailbox(rootUR.ToString()));
SearchFilter[] isEqualTo = new SearchFilter[] { new SearchFilter.IsEqualTo(EmailMessageSchema.IsRead, false) };
SearchFilter searchFilterCollection = new SearchFilter.SearchFilterCollection(0, isEqualTo);
FindItemsResults<Item> findItemsResult = exchangeService1.FindItems(folderId, searchFilterCollection, new ItemView(100));
return new List<Item>(findItemsResult.Items);
}
Я хочу вызвать выше метод в этом методе
private void GearrayListEmailList(string strCheckFolder)
{
try
{
LB_ActionError.Text = string.Empty;
PH_MsgDetail.Visible = false;
ArrayList arrayListEmailList = EmailMsg.GetEmailList(strCheckFolder);
LB_CurBox.Text = string.Format(CultureInfo.CurrentCulture, "{0} ({1})", strCheckFolder, arrayListEmailList.Count);
int intTotal = arrayListEmailList.Count;
if (intTotal == 0)
{
LB_ActionStatus.Text = Utility.SetActStatus(true, "There is no email message found in this folder.");
GV_EmailList.DataSource = new ArrayList();
GV_EmailList.DataBind();
GV_EmailList.Visible = false;
}
else
{
LB_ActionStatus.Text = Utility.SetActStatus(true, string.Format(CultureInfo.CurrentCulture, "There are {0} email message(s) found in this folder.", intTotal));
GV_EmailList.DataSource = arrayListEmailList;
GV_EmailList.DataBind();
GV_EmailList.Visible = true;
GV_EmailList.SelectedIndex = -1;
}
}
catch (Exception ex)
{
LB_ActionStatus.Text = Utility.SetActStatus(false, ex.Message);
}
LB_AdminEmailBox.Text = string.Format(CultureInfo.CurrentCulture, Entity.GetSetting("RootURI"), strCheckFolder);
}
Я знаю, что должен вызывать этот метод здесь ArrayList arrayListEmailList = EmailMsg.GetEmailList (strCheckFolder); но не уверен, что я должен использовать, чтобы заменить ArrayList на List. Могу ли я получить помощь по этому вопросу. Спасибо