/// <summary> /// 多个地址转换成多个通讯录ID /// </summary> /// <param name="vault"></param> /// <param name="list"></param> /// <returns></returns> private static IEnumerable <int> ConvertAddrsToIds(Vault vault, IEnumerable <MailAddress> list) { var bookIds = new List <int>(); foreach (var item in list) { //var value = String.Format("{0}<{1}>", item.DisplayName, item.Address); var id = LinkmanByMf.SearchLinkManId(vault, item.DisplayName, item.Address); bookIds.Add(id); } return(bookIds.ToArray()); }
/// <summary> /// 多个地址转换成多个通讯录ID /// </summary> /// <param name="vault"></param> /// <param name="list"></param> /// <returns></returns> private static IEnumerable <int> ConvertAddrsToIds(Vault vault, IEnumerable <MailboxAddress> list) { var bookIds = new List <int>(); foreach (var item in list) { var displayName = item.Name; if (String.IsNullOrEmpty(displayName)) { var pos = item.Address.IndexOf('@'); displayName = item.Address.Substring(0, pos); } var id = LinkmanByMf.SearchLinkManId(vault, displayName, item.Address); bookIds.Add(id); } return(bookIds.ToArray()); }
/// <summary> /// 单个接收者转换成通讯录ID /// </summary> /// <param name="vault"></param> /// <param name="addr"></param> /// <returns></returns> private static int ConvertAddrToId(Vault vault, MailAddress addr) { return(LinkmanByMf.SearchLinkManId(vault, addr.DisplayName, addr.Address)); }