如何在另一个方法内调用列表方法

时间:2019-05-16 07:07:44

标签: c# asp.net httpwebrequest exchange-server exchangewebservices

我正在尝试在此处显示电子邮件列表,我想使用我的List方法替换我方法中的Arraylist。 显示电子邮件列表的方法

version: 0.1
log:
  fields:
    service: registry
storage:
    cache:
        layerinfo: inmemory
    filesystem:
        rootdirectory: /var/lib/registry
http:
    addr: 0.0.0.0:443
    tls:
        certificate: /certs/certificate.crt
        key: /certs/key.key
auth:
    htpasswd:
        realm: somerealm
        path: /auth/registry.password

我要在此方法中调用上述方法

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);
        }

我知道我必须在这里调用该方法ArrayList arrayListEmailList = EmailMsg.GetEmailList(strCheckFolder);但不确定应使用什么将ArrayList替换为List。我可以帮忙吗?谢谢

0 个答案:

没有答案