public static Transport Create(AddressEntry entry) { switch (entry.Method) { case "tcp": { Transport transport = new SocketTransport(); transport.Open(entry); return(transport); } #if !PORTABLE case "unix": { Transport transport = new UnixNativeTransport(); transport.Open(entry); return(transport); } #endif #if ENABLE_PIPES case "win": { Transport transport = new PipeTransport(); transport.Open(entry); return(transport); } #endif default: throw new NotSupportedException("Transport method \"" + entry.Method + "\" not supported"); } }
public addressListViewModel(AddressList a) : base(a) { _showOnlyGroupsFilter = false; var query = from AddressEntry e in _entity.AddressEntries select e; entries = new ObservableCollection <AddressEntry>(query); _view = CollectionViewSource.GetDefaultView(entries); _view.Filter = delegate(object obj) { AddressEntry e = (AddressEntry)obj; bool isShown = String.IsNullOrEmpty(_nameFilter) ? true : e.Name.Contains(_nameFilter); isShown &= (_showOnlyGroupsFilter == OutlookProvider.isGroup(e)); return(isShown); }; _view.CurrentChanged += delegate { RaisePropertyChanged("selectedPersonCollection"); RaisePropertyChanged("selectedTeacher"); RaisePropertyChanged("selectedSeat"); RaisePropertyChanged("selectedSeatGroup"); }; }
public void PollingAddressAsyncTest() { var context = GetSelectContext(); var indexs = new List <int>(); var entry = new AddressEntry(context.Address, indexs); var status = Parallel.For(0, 200, index => { entry.GetAddress(); }); while (!status.IsCompleted) { Thread.Sleep(10); } for (var i = 0; i < indexs.Count; i++) { if (indexs.Count == i + 1) { break; } var current = indexs.ElementAt(i); var next = indexs.ElementAt(i + 1); Assert.True((next == 0 && current == 99) || current == next - 1); } }
public static Transport Create(AddressEntry entry) { switch (entry.Method) { case "tcp": { Transport transport = new SocketTransport (); transport.Open (entry); return transport; } #if !PORTABLE case "unix": { Transport transport = new UnixNativeTransport (); transport.Open (entry); return transport; } #endif #if ENABLE_PIPES case "win": { Transport transport = new PipeTransport (); transport.Open (entry); return transport; } #endif default: throw new NotSupportedException ("Transport method \"" + entry.Method + "\" not supported"); } }
public void GetSenderInfoAppointTest3() { string testName = "Kinoshita Yasuyuki (木下 康行)"; string testEmailAddress = "*****@*****.**"; string expectedNameAndAddress = string.Format("{0}<{1}>", testName, testEmailAddress); testAdd = Substitute.For <AddressEntry>(); testAppointment = Substitute.For <AppointmentItem>(); // Recipients[1]のExchangeUserで例外が発生 testAppointment.Recipients[1].AddressEntry.Returns(x => { throw new System.Exception(); }); // モックのReturn値を設定 testNs.CurrentUser.AddressEntry.Returns(testAdd); testAdd.Name = testName; testAdd.Address = testEmailAddress; testAdd.GetExchangeUser().Returns((ExchangeUser)null); // テストするメソッドにアクセスし、実際の結果を取得 RecipientInformationDto actual = (RecipientInformationDto)mi.Invoke(obj, new object[] { testAppointment }); // 期待結果 RecipientInformationDto expected = new RecipientInformationDto(expectedNameAndAddress, OlMailRecipientType.olOriginator); // actualとexpectedを比較 CompareRecInfoDto(actual, expected); }
private string GetSenderSMTPAddress(MailItem mail) { string schemaName = "http://schemas.microsoft.com/mapi/proptag/0x39FE001E"; if (mail == null) { throw new ArgumentNullException(); } if (mail.SenderEmailType != "EX") { return(mail.SenderEmailAddress); } AddressEntry sender = mail.Sender; if (sender == null) { return(null); } if ((sender.AddressEntryUserType != OlAddressEntryUserType.olExchangeUserAddressEntry) && (sender.AddressEntryUserType != OlAddressEntryUserType.olExchangeRemoteUserAddressEntry)) { return(sender.PropertyAccessor.GetProperty(schemaName) as string); } ExchangeUser exchangeUser = sender.GetExchangeUser(); return(exchangeUser?.PrimarySmtpAddress); }
public void GetSenderInfoMeetingTest5() { string testAddress = "*****@*****.**"; string testName = "Yasuyuki Kinoshita / R / RSI"; string expectedNameAndAddress = string.Format("{0}<{1}>", testName, testAddress); testAdd = Substitute.For <AddressEntry>(); // モックでつかうデータを用意 testMeeting.SenderName.Returns(testName); testMeeting.SenderEmailAddress.Returns(testAddress); // モックのReturn値を設定 testRec.AddressEntry.Returns(testAdd); testRec.Name.Returns(testName); testRec.Address.Returns(testAddress); // GetExchangeUserメソッドで、例外が発生 testAdd.GetExchangeUser().Returns((ExchangeUser)null); // テストするメソッドにアクセスし、実際の結果を取得 RecipientInformationDto actual = (RecipientInformationDto)mi.Invoke(obj, new object[] { testMeeting }); // 期待結果 RecipientInformationDto expected = new RecipientInformationDto(expectedNameAndAddress, OlMailRecipientType.olOriginator); // actualとexpectedを比較 CompareRecInfoDto(actual, expected); }
public void GetSenderInfoMailTest3() { string testName = "Kobayashi Gen (小林 元)"; string testCompanyName = "リコーITソリューションズ"; string testDepartment = "ビジネスソリューションズ事業部 システム開発センター 第1開発部 第1グループ"; string testJobTitle = "部長"; testAdd = Substitute.For <AddressEntry>(); // モックでつかうデータを用意 testMail.Sender = null; testMail.SenderEmailAddress.Returns("*****@*****.**"); testAdd = Substitute.For <AddressEntry>(); // モックのReturn値を設定 testRec.AddressEntry.Returns(testAdd); testExchUser.Name.Returns(testName); testExchUser.Department.Returns(testDepartment); testExchUser.CompanyName.Returns(testCompanyName); testExchUser.JobTitle.Returns(testJobTitle); testAdd.GetExchangeUser().Returns(testExchUser); // テストするメソッドにアクセスし、実際の結果を取得 RecipientInformationDto actual = (RecipientInformationDto)mi.Invoke(obj, new object[] { testMail }); // 期待結果 RecipientInformationDto expected = new RecipientInformationDto(testName, testDepartment, testCompanyName, testJobTitle, OlMailRecipientType.olOriginator); // actualとexpectedを比較 CompareRecInfoDto(actual, expected); }
public void GetSenderInfoAppointTest2() { string testName = "Kosaka Kenta (小坂 健太)"; string testCompanyName = "リコーITソリューションズ"; string testDepartment = "ビジネスソリューションズ事業部 システム開発センター 第1開発部 第1グループ"; string testJobTitle = "担当"; string expectedJobTitle = ""; testAdd = Substitute.For <AddressEntry>(); testAppointment = Substitute.For <AppointmentItem>(); // Recipients[1]のExchangeUserで例外が発生 testAppointment.Recipients[1].AddressEntry.Returns(x => { throw new System.Exception(); }); // モックのReturn値を設定 testNs.CurrentUser.AddressEntry.Returns(testAdd); testExchUser.Name.Returns(testName); testExchUser.Department.Returns(testDepartment); testExchUser.CompanyName.Returns(testCompanyName); testExchUser.JobTitle.Returns(testJobTitle); testAdd.GetExchangeUser().Returns(testExchUser); // テストするメソッドにアクセスし、実際の結果を取得 RecipientInformationDto actual = (RecipientInformationDto)mi.Invoke(obj, new object[] { testAppointment }); // 期待結果 RecipientInformationDto expected = new RecipientInformationDto(testName, testDepartment, testCompanyName, expectedJobTitle, OlMailRecipientType.olOriginator); // actualとexpectedを比較 CompareRecInfoDto(actual, expected); }
public override void Open(AddressEntry entry) { string host, portStr, family; int port; if (!entry.Properties.TryGetValue("host", out host)) { host = "localhost"; } if (!entry.Properties.TryGetValue("port", out portStr)) { throw new Exception("No port specified"); } if (!Int32.TryParse(portStr, out port)) { throw new Exception("Invalid port: \"" + port + "\""); } if (!entry.Properties.TryGetValue("family", out family)) { family = null; } Open(host, port, family); }
public void GetSenderInfoSharingTest2() { string testName = "Kosaka Kenta (小坂 健太)"; string testEmailAddress = "*****@*****.**"; string expectedNameAndAddress = string.Format("{0}<{1}>", testName, testEmailAddress); testAdd = Substitute.For <AddressEntry>(); // モックでつかうデータを用意 testSharing.SenderName.Returns(testName); testSharing.SenderEmailAddress.Returns(testEmailAddress); // モックのReturn値を設定 testRec.AddressEntry.Returns(testAdd); // GetExchangeUserメソッドで、例外が発生 testAdd.GetExchangeUser().Returns(x => { throw new System.Exception(); }); // テストするメソッドにアクセスし、実際の結果を取得 RecipientInformationDto actual = (RecipientInformationDto)mi.Invoke(obj, new object[] { testSharing }); // 期待結果 RecipientInformationDto expected = new RecipientInformationDto(expectedNameAndAddress, OlMailRecipientType.olOriginator); // actualとexpectedを比較 CompareRecInfoDto(actual, expected); }
// set source to any to receive from any source address, otherwise will only report those source addresses that match // set dest to any to receive data for any destination address, localhost to get only packets destined to the local // unicast address, set to any other address (including multicast, broadcast) to get packets for only that destination public void Subscribe(IPAddress sourceAddress, IPAddress destAddress, SocketDataReceivedEventHandler callback) { AddressEntry entry = new AddressEntry(sourceAddress, destAddress, callback); lock (addressEntries) { // determine if this is a multicast destination if (IsMulticast(destAddress)) { // it is, so join the group if we aren't already in it bool inGroup = false; foreach (AddressEntry ent in addressEntries) { if (ent.destAddress.Equals(destAddress)) { inGroup = true; } } if (!inGroup) { socket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(destAddress)); } } if (IsBroadcast(destAddress)) { if (!socket.EnableBroadcast) { socket.EnableBroadcast = true; } } // add to the list of address entries addressEntries.Add(entry); } }
public String GetCurrentUserInfos() { StringBuilder wComputername = new StringBuilder(string.Format("{0} ({1})", Environment.MachineName, Environment.OSVersion.ToString())); StringBuilder wUsername = new StringBuilder(string.Format("{0}\\{1}", Environment.UserDomainName, Environment.UserName)); StringBuilder usefullInfo = new StringBuilder("Possibly useful information:\n--------------"); AddressEntry addrEntry = Globals.ThisAddIn.Application.Session.CurrentUser.AddressEntry; if (addrEntry.Type == "EX") { ExchangeUser currentUser = Globals.ThisAddIn.Application.Session.CurrentUser. AddressEntry.GetExchangeUser(); if (currentUser != null) { usefullInfo.AppendLine(); usefullInfo.Append(string.Format("Name: {0}", currentUser.Name)); usefullInfo.AppendLine(); usefullInfo.Append(string.Format("STMP address: {0}", currentUser.PrimarySmtpAddress)); usefullInfo.AppendLine(); usefullInfo.Append(string.Format("Business phone: {0}", currentUser.BusinessTelephoneNumber)); usefullInfo.AppendLine(); usefullInfo.Append(string.Format("Mobile phone: {0}", currentUser.MobileTelephoneNumber)); } } usefullInfo.AppendLine(); usefullInfo.Append(string.Format("Windows username: {0}", wUsername.ToString())); usefullInfo.AppendLine(); usefullInfo.Append(string.Format("Computername: {0}", wComputername.ToString())); usefullInfo.AppendLine(); return(usefullInfo.ToString()); }
public void ToAddress() { if (SelectedDeliveryLine != null) { var toAddr = new AddressDTO { Country = "Ethiopia", City = "Addis Abeba" }; if (SelectedDeliveryLine.ToAddress != null) { toAddr = MapperUtility <AddressDTO> .GetMap(SelectedDeliveryLine.ToAddress, toAddr) as AddressDTO; } if (toAddr != null) { var addr = new AddressEntry(toAddr); addr.ShowDialog(); var dialogueResult = addr.DialogResult; if (dialogueResult != null && (bool)dialogueResult) { SelectedDeliveryLine.ToAddress = toAddr; ToAdressDetail = new ObservableCollection <AddressDTO> { toAddr }; } } } }
private static bool IsNormalMeetingRoom(AddressEntry room) { var roomName = room.Name; if (!roomName.StartsWith("CN BJS (ARCA")) { return(false); } if (roomName.Contains("Training")) { return(false); } if (roomName.Contains("Imperial Garden")) { return(false); } if (roomName.Contains("Grand View Park")) { return(false); } return(true); }
private string GetSenderEmailAddress(AddressEntry sender) { string SenderEmailAddress = null; try { var outlookApp = Globals.ThisAddIn.Application as Microsoft.Office.Interop.Outlook.Application; if (sender == null) { ExchangeUser exchUser = outlookApp.Session.CurrentUser.AddressEntry.GetExchangeUser(); SenderEmailAddress = exchUser.PrimarySmtpAddress; } else if (sender.AddressEntryUserType == OlAddressEntryUserType.olExchangeUserAddressEntry || sender.AddressEntryUserType == OlAddressEntryUserType.olExchangeRemoteUserAddressEntry) { ExchangeUser exchUser = sender.GetExchangeUser(); if (exchUser != null) { SenderEmailAddress = exchUser.PrimarySmtpAddress; } } //else //{ // SenderEmailAddress = mail.SenderEmailAddress; //} } catch (System.Exception ex) { MessageBox.Show(ex.Message, "error", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(SenderEmailAddress); }
// Determine if the email is internal or external public static String GetEmailAddress(MailItem email, String direction) { String address; if (email.SenderEmailType == "EX") { AddressEntry addressEntry = direction.Equals("outgoing") ? email.Recipients[1].AddressEntry : email.Sender; if (addressEntry.AddressEntryUserType == OlAddressEntryUserType.olExchangeUserAddressEntry || addressEntry.AddressEntryUserType == OlAddressEntryUserType.olExchangeRemoteUserAddressEntry) { ExchangeUser internalAddress = addressEntry.GetExchangeUser(); address = internalAddress.PrimarySmtpAddress; } else if (addressEntry.Members != null) { address = addressEntry.GetExchangeDistributionList().PrimarySmtpAddress; } else { address = email.Recipients[1].Address; } } else { address = email.Sender.Address; } return(address); }
public void FromAddress() { if (SelectedDeliveryLine != null && SelectedDeliveryLine.FromAddress != null) { var fromAddr = new AddressDTO { Country = "Ethiopia", City = "Addis Abeba" }; fromAddr = MapperUtility <AddressDTO> .GetMap(SelectedDeliveryLine.FromAddress, fromAddr) as AddressDTO; if (fromAddr != null) { fromAddr.Id = 0; var addr = new AddressEntry(fromAddr); addr.ShowDialog(); var dialogueResult = addr.DialogResult; if (dialogueResult != null && (bool)dialogueResult) { SelectedDeliveryLine.FromAddress = fromAddr; FromAdressDetail = new ObservableCollection <AddressDTO> { fromAddr }; } } } }
static void Main() { //Application.Run(new frmCtrlConsumer()); MAPI.Session session = new SessionClass(); session.GetType().InvokeMember("Logon", BindingFlags.InvokeMethod, null, session, new Object[] {}); AddressLists addrs = null; try { addrs = (AddressLists)session.AddressLists; } catch (Exception ex) { MessageBox.Show(ex.Message); return; } int addrCnt = (int)addrs.Count; string x = ""; for (int i = 1; i <= addrCnt; i++) { AddressList curAddr = (AddressList)addrs.get_Item(i); x += (string)curAddr.Name + ":\n"; AddressEntries entries = (AddressEntries)curAddr.AddressEntries; int entryCnt = (int)entries.Count; for (int j = 1; j <= entryCnt; j++) { AddressEntry curEntry = (AddressEntry)entries.get_Item(j); string address; try{ address = (string)curEntry.Address; }catch { address = "<null>"; } x += (string)curEntry.Name + ": " + address + " -> " + (int)curEntry.DisplayType + "\n"; } } MessageBox.Show(x); }
private string GetAddress(AddressEntry ae) { const string PR_SMTP_ADDRESS = @"http://schemas.microsoft.com/mapi/proptag/0x39FE001E"; if (ae == null) { return(null); } //Now we have an AddressEntry representing the Sender if (ae.AddressEntryUserType == OlAddressEntryUserType.olExchangeUserAddressEntry || ae.AddressEntryUserType == OlAddressEntryUserType.olExchangeRemoteUserAddressEntry) { //Use the ExchangeUser object PrimarySMTPAddress var exchUser = ae.GetExchangeUser(); return(exchUser?.PrimarySmtpAddress); } try { return(ae.PropertyAccessor.GetProperty(PR_SMTP_ADDRESS) as string); } catch { return(string.Empty); } }
public void GetSenderInfoSharingTest1() { string testName = "Kosaka Kenta (小坂 健太)"; string testCompanyName = "リコーITソリューションズ"; string testDepartment = "ビジネスソリューションズ事業部 システム開発センター 第1開発部 第1グループ"; string testJobTitle = "担当"; string testEmailAddress = "*****@*****.**"; string expectedJobTitle = ""; testAdd = Substitute.For <AddressEntry>(); // モックのReturn値を設定 testSharing.SenderEmailAddress.Returns(testEmailAddress); testRec.AddressEntry.Returns(testAdd); testAdd.GetExchangeUser().Returns(testExchUser); testExchUser.Name.Returns(testName); testExchUser.Department.Returns(testDepartment); testExchUser.CompanyName.Returns(testCompanyName); testExchUser.JobTitle.Returns(testJobTitle); // テストするメソッドにアクセスし、実際の結果を取得 RecipientInformationDto actual = (RecipientInformationDto)mi.Invoke(obj, new object[] { testSharing }); // 期待結果 RecipientInformationDto expected = new RecipientInformationDto(testName, testDepartment, testCompanyName, expectedJobTitle, OlMailRecipientType.olOriginator); // actualとexpectedを比較 CompareRecInfoDto(actual, expected); }
private static bool IsAvailable(AddressEntry entry, DateTime startTime, TimeSpan duration) { int length = (int)duration.TotalMinutes; int index = (int)startTime.TimeOfDay.TotalMinutes; string freeBusyResult = entry.GetFreeBusy(startTime, 1); return(!freeBusyResult.Substring(index, length).Contains("1")); }
public HouseholdRegistration() { InitializeComponent(); ContentNameEntry.Completed += (sender, e) => EmailAddressEntry.Focus(); EmailAddressEntry.Completed += (sender, e) => EmailAddressEntry.Focus(); ContactNumberEntry.Completed += (sender, e) => AddressEntry.Focus(); //AddressEntry.Completed += (sender, e) => }
void Handle_Focused(object sender, Xamarin.Forms.FocusEventArgs e) { AddressEntry.Unfocus(); var picker = new AddressPickerPage(); picker.eventHandler = DidSelectAddressHandler; Navigation.PushAsync(picker, true); }
public SupermarketRegistration() { InitializeComponent(); NameBusinessEntry.Completed += (sender, e) => ContentNameEntry.Focus(); ContentNameEntry.Completed += (sender, e) => EmailAddressEntry.Focus(); EmailAddressEntry.Completed += (sender, e) => ContactNumberEntry.Focus(); ContactNumberEntry.Completed += (sender, e) => AddressEntry.Focus(); //AddressEntry.Completed += (sender, e) => AddressEntry.Focus(); }
private string[] Recipients(Recipients recipients, string organisator_ID) { // RequiredAttendees_Names, OptionalAttendees_Names, RequiredAttendees_Full, OptionalAttendees_Full string[] output = new string[] { "", "", "", "" }; // https://docs.microsoft.com/de-de/office/vba/api/outlook.appointmentItem.recipients foreach (Recipient recipient in recipients) { AddressEntry adressEntry = recipient.AddressEntry; // TODO Testing with somebody //if(recipient.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x5FFD0003")) //https://stackoverflow.com/questions/49927811/outlook-appointment-meeting-organizer-information-inconsistent if (adressEntry.ID != organisator_ID) { // https://docs.microsoft.com/de-de/office/vba/api/outlook.recipient.resolve bool resolved = recipient.Resolve(); // https://docs.microsoft.com/de-de/office/vba/api/outlook.addressentry.name // https://docs.microsoft.com/de-de/office/vba/api/outlook.recipient.meetingresponsestatus // TODO Mail-Adresse https://docs.microsoft.com/de-de/office/vba/api/outlook.recipient.address string[] result = AdressEntryNameExtract(adressEntry); string NamesText = (resolved & !String.IsNullOrEmpty(result[0]) ? result[0] : recipient.Name) + (!String.IsNullOrEmpty(MeetingResponseToStr(recipient.MeetingResponseStatus)) ? " (" + MeetingResponseToStr(recipient.MeetingResponseStatus) + ")" : ""); string FullText = (resolved & !String.IsNullOrEmpty(result[1]) ? result[1] : recipient.Name + " [" + I18n("NOT_FOUND_IN") + " " + I18n("ADDRESS_BOOK") + "]") + (!String.IsNullOrEmpty(MeetingResponseToStr(recipient.MeetingResponseStatus)) ? " (" + MeetingResponseToStr(recipient.MeetingResponseStatus) + ")" : ""); // https://docs.microsoft.com/de-de/office/vba/api/outlook.recipient.type int x; if (recipient.Type != 2) { if (recipient.Type != 1) { DPrint("olOrganizer or olResource detected", 1); // olOrganizer or olResource } x = 0; // olRequired } else // olOptional { x = 1; } output[x] += NamesText + STRING_SEPERATOR; output[x + 2] += FullText + STRING_SEPERATOR; } else { DPrint("The organisator was found in the recipients", 2); } } for (int i = 0; i < output.Length; i++) { if (output[i].Length > 1) { output[i] = output[i].Remove(output[i].Length - STRING_SEPERATOR.Length); } } return(output); }
void SetAddressEntry(string controlName, Address address) { AddressEntry addBox = (AddressEntry)wizCheckout.FindControl(controlName); if (addBox != null) { addBox.SelectedAddress = address; } }
private async Task <Stream> DoPost(HttpClient client, AddressEntry address, byte[] postBuf) { var content = new ByteArrayContent(postBuf); content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream"); var responseMessage = await client.PostAsync(address.RequestUri, content); responseMessage.EnsureSuccessStatusCode(); return(await responseMessage.Content.ReadAsStreamAsync()); }
public void SponsorAddress() { var addr = new AddressEntry(SelectedVisa.Sponsor.Address); addr.ShowDialog(); if (addr.DialogResult != null && (bool)addr.DialogResult) { SaveVisa(); } }
public AddContact() { InitializeComponent(); NavigationPage.SetHasBackButton(this, false); nameEntry.ReturnCommand = new Command(() => emailEntry.Focus()); emailEntry.ReturnCommand = new Command(() => phoneEntry.Focus()); phoneEntry.ReturnCommand = new Command(() => AddressEntry.Focus()); isAdd = true; }
Address GetAddressEntry(string controlName) { Address add = null; AddressEntry addBox = (AddressEntry)wizCheckout.FindControl(controlName); if (addBox != null) { add = addBox.SelectedAddress; } return(add); }
//public BitmapImage EmployeeShortImage //{ // get { return _employeeShortImage; } // set // { // _employeeShortImage = value; // RaisePropertyChanged<BitmapImage>(() => EmployeeShortImage); // } //} public void EmployeeAddress() { var addr = new AddressEntry(SelectedEmployee.Address); addr.ShowDialog(); bool?dialogueResult = addr.DialogResult; if (dialogueResult != null && (bool)dialogueResult) { SaveEmployee(); } }
public override void Open(AddressEntry entry) { string host; string path; if (!entry.Properties.TryGetValue ("host", out host)) host = "."; // '.' is localhost if (!entry.Properties.TryGetValue ("path", out path)) throw new Exception ("No path specified"); Open (host, path); }
public override void Open(AddressEntry entry) { string path; bool abstr; if (entry.Properties.TryGetValue ("path", out path)) abstr = false; else if (entry.Properties.TryGetValue ("abstract", out path)) abstr = true; else throw new Exception ("No path specified for UNIX transport"); Open (path, abstr); }
public static string GetSmtpAddress(AddressEntry entry) { if (entry.AddressEntryUserType.ToString().IndexOf("exchange", StringComparison.OrdinalIgnoreCase) > 0) { dynamic exch = (dynamic)entry.GetExchangeUser() ?? (dynamic)entry.GetExchangeDistributionList(); if (exch != null) return exch.PrimarySmtpAddress; } else if (entry.AddressEntryUserType == OlAddressEntryUserType.olSmtpAddressEntry) { return entry.Address; } // Default if nothing worked. string PR_SMTP_ADDRESS = @"http://schemas.microsoft.com/mapi/proptag/0x39FE001E"; return entry.PropertyAccessor.GetProperty(PR_SMTP_ADDRESS) as string; }
public override void Open (AddressEntry entry) { string host, portStr; int port; if (!entry.Properties.TryGetValue ("host", out host)) throw new Exception ("No host specified"); if (!entry.Properties.TryGetValue ("port", out portStr)) throw new Exception ("No port specified"); if (!Int32.TryParse (portStr, out port)) throw new Exception ("Invalid port: \"" + port + "\""); Open (host, port); }
public override void Open(AddressEntry entry) { string host, portStr, family; int port; if (!entry.Properties.TryGetValue("host", out host)) host = "localhost"; if (!entry.Properties.TryGetValue("port", out portStr)) throw new Exception("No port specified"); if (!Int32.TryParse(portStr, out port)) throw new Exception("Invalid port: \"" + port + "\""); if (!entry.Properties.TryGetValue("family", out family)) family = null; Open(host, port, family); }
private List<string> ResolveAddressEntry(AddressEntry ae) { var emailAddresses = new List<string>(); switch(ae.AddressEntryUserType) { case OlAddressEntryUserType.olExchangeRemoteUserAddressEntry: case OlAddressEntryUserType.olExchangeUserAddressEntry: { emailAddresses.Add(ResolveUserAddressEntry(ae)); break; } case OlAddressEntryUserType.olExchangeDistributionListAddressEntry: { if (_distributionListsSeen.Contains(ae.Name)) return emailAddresses; _distributionListsSeen.Add(ae.Name); emailAddresses.AddRange(ResoveExchangeDistributionList(ae)); break; } case OlAddressEntryUserType.olOutlookDistributionListAddressEntry: { if (_distributionListsSeen.Contains(ae.Name)) return emailAddresses; _distributionListsSeen.Add(ae.Name); emailAddresses.AddRange(ResoveOutlookDistributionList(ae)); break; } case OlAddressEntryUserType.olSmtpAddressEntry: { emailAddresses.Add(ae.Address); break; } } return emailAddresses; }
public override void Open(AddressEntry entry) { string path; bool isAbstract; if (entry.Properties.TryGetValue("path", out path)) isAbstract = false; else if (entry.Properties.TryGetValue("abstract", out path)) isAbstract = true; else throw new ArgumentException("No path specified for UNIX transport"); EndPoint ep; if (isAbstract) ep = new AbstractUnixEndPoint(path); else ep = new UnixEndPoint(path); var client = new Socket(AddressFamily.Unix, SocketType.Stream, 0); client.Connect(ep); Stream = new NetworkStream(client); }
public WsAddressEntry(AddressEntry addressEntry) { _addressEntry = addressEntry; }
public static Transport Create(AddressEntry entry) { switch (entry.Method) { case "tcp": { Transport transport = new SocketTransport (); transport.Open (entry); return transport; } case "unix": { if (OSHelpers.PlatformIsUnixoid) { Transport transport = new UnixNativeTransport (); transport.Open (entry); return transport; } break; } #if ENABLE_PIPES case "win": { Transport transport = new PipeTransport (); transport.Open (entry); return transport; } #endif // "autolaunch:" means: the first client user of the dbus library shall spawn the daemon on itself, see dbus 1.7.8 from http://dbus.freedesktop.org/releases/dbus/ case "autolaunch": { if (OSHelpers.PlatformIsUnixoid) break; string addr = Address.GetSessionBusAddressFromSharedMemory (); if (string.IsNullOrEmpty (addr)) { // we have to launch the daemon ourselves string oldDir = Directory.GetCurrentDirectory (); // Without this, the "current" folder for the new process will be the one where the current // executable resides, and as a consequence,that folder cannot be relocated/deleted unless the daemon is stopped Directory.SetCurrentDirectory (Environment.GetFolderPath (Environment.SpecialFolder.System)); Process process = Process.Start (DBUS_DAEMON_LAUNCH_COMMAND); if (process == null) { Directory.SetCurrentDirectory (oldDir); throw new NotSupportedException ("Transport method \"autolaunch:\" - cannot launch dbus daemon '" + DBUS_DAEMON_LAUNCH_COMMAND + "'"); } // wait for daemon Stopwatch stopwatch = new Stopwatch (); stopwatch.Start (); do { addr = Address.GetSessionBusAddressFromSharedMemory (); if (String.IsNullOrEmpty (addr)) Thread.Sleep (100); } while (String.IsNullOrEmpty (addr) && stopwatch.ElapsedMilliseconds <= 5000); Directory.SetCurrentDirectory (oldDir); } if (string.IsNullOrEmpty (addr)) throw new NotSupportedException ("Transport method \"autolaunch:\" - timeout during access to freshly launched dbus daemon"); return Create (AddressEntry.Parse (addr)); } } throw new NotSupportedException ("Transport method \"" + entry.Method + "\" not supported"); }
private List<string> ResoveOutlookDistributionList(AddressEntry addressEntry) { var emailAddresses = new List<string>(); var members = addressEntry.Members; using (new ComRelease(members)) { for (int k = 1; k <= members.Count; k++) { var ae = members[k]; using (new ComRelease(ae)) { emailAddresses.AddRange(ResolveAddressEntry(ae)); } } } return emailAddresses; }
public abstract void Open(AddressEntry entry);
public static string GetEmailAdressOrNull (AddressEntry addressEntry, IEntityMappingLogger logger, ILog generalLogger) { OlAddressEntryUserType type; if (addressEntry != null) { try { type = addressEntry.AddressEntryUserType; } catch (COMException ex) { generalLogger.Warn ("Could not get type from AddressEntry", ex); logger.LogMappingWarning ("Could not get type from AddressEntry", ex); return null; } if (type == OlAddressEntryUserType.olExchangeUserAddressEntry || type == OlAddressEntryUserType.olExchangeRemoteUserAddressEntry || type == OlAddressEntryUserType.olExchangeAgentAddressEntry || type == OlAddressEntryUserType.olExchangeOrganizationAddressEntry || type == OlAddressEntryUserType.olExchangePublicFolderAddressEntry) { try { using (var exchUser = GenericComObjectWrapper.Create (addressEntry.GetExchangeUser ())) { if (exchUser.Inner != null) { return exchUser.Inner.PrimarySmtpAddress; } } } catch (COMException ex) { generalLogger.Warn ("Could not get email address from adressEntry.GetExchangeUser()", ex); logger.LogMappingWarning ("Could not get email address from adressEntry.GetExchangeUser()", ex); } } else if (type == OlAddressEntryUserType.olExchangeDistributionListAddressEntry || type == OlAddressEntryUserType.olOutlookDistributionListAddressEntry) { try { using (var exchDL = GenericComObjectWrapper.Create (addressEntry.GetExchangeDistributionList ())) { if (exchDL.Inner != null) { return exchDL.Inner.PrimarySmtpAddress; } } } catch (COMException ex) { generalLogger.Warn ("Could not get email address from adressEntry.GetExchangeDistributionList()", ex); logger.LogMappingWarning ("Could not get email address from adressEntry.GetExchangeDistributionList()", ex); } } else if (type == OlAddressEntryUserType.olSmtpAddressEntry || type == OlAddressEntryUserType.olLdapAddressEntry) { return addressEntry.Address; } else if (type == OlAddressEntryUserType.olOutlookContactAddressEntry) { if (addressEntry.Type == "EX") { try { using (var exchContact = GenericComObjectWrapper.Create (addressEntry.GetContact ())) { if (exchContact.Inner != null) { if (exchContact.Inner.Email1AddressType == "EX") { return exchContact.Inner.GetPropertySafe (PR_EMAIL1ADDRESS); } else { return exchContact.Inner.Email1Address; } } } } catch (COMException ex) { generalLogger.Warn ("Could not get email address from adressEntry.GetContact()", ex); logger.LogMappingWarning ("Could not get email address from adressEntry.GetContact()", ex); } } else { return addressEntry.Address; } } else { try { return addressEntry.GetPropertySafe (PR_SMTP_ADDRESS); } catch (COMException ex) { generalLogger.Warn ("Could not get property PR_SMTP_ADDRESS for adressEntry", ex); logger.LogMappingWarning ("Could not get property PR_SMTP_ADDRESS for adressEntry", ex); } } } return null; }
public override void Open(AddressEntry entry) { string host, portStr, family; byte[] nonce = {}; int port; if (!entry.Properties.TryGetValue ("host", out host)) host = "localhost"; if (!entry.Properties.TryGetValue ("port", out portStr)) throw new Exception ("No port specified"); if (entry.Method == "nonce-tcp") { string nonceFile; if (!entry.Properties.TryGetValue ("noncefile", out nonceFile)) throw new Exception ("No noncefile specified"); nonce = File.ReadAllBytes (nonceFile); if (nonce.Length != 16) throw new Exception ("Nonce should be 16 bytes"); } if (!Int32.TryParse (portStr, out port)) throw new Exception ("Invalid port: \"" + port + "\""); if (!entry.Properties.TryGetValue ("family", out family)) family = null; Open (host, port, family, nonce); }
private string GetAddress(AddressEntry ae) { string PR_SMTP_ADDRESS = @"http://schemas.microsoft.com/mapi/proptag/0x39FE001E"; if (ae != null) { //Now we have an AddressEntry representing the Sender if (ae.AddressEntryUserType == Microsoft.Office.Interop.Outlook.OlAddressEntryUserType. olExchangeUserAddressEntry || ae.AddressEntryUserType == Microsoft.Office.Interop.Outlook.OlAddressEntryUserType. olExchangeRemoteUserAddressEntry) { //Use the ExchangeUser object PrimarySMTPAddress Microsoft.Office.Interop.Outlook.ExchangeUser exchUser = ae.GetExchangeUser(); if (exchUser != null) { return exchUser.PrimarySmtpAddress; } else { return null; } } else { try { return ae.PropertyAccessor.GetProperty(PR_SMTP_ADDRESS) as string; } catch { return string.Empty; } } } else { return null; } }
public void Dispose() { if (_wsPropertyAccessor != null) { _wsPropertyAccessor.Dispose(); _wsPropertyAccessor = null; } if (_wsApplication != null) { _wsApplication.Dispose(); _wsApplication = null; } if (_wsAddressEntryManager != null) { _wsAddressEntryManager.Dispose(); _wsAddressEntryManager = null; } if (_addressEntries != null) { _addressEntries.Dispose(); _addressEntries = null; } if (_addressEntry != null) { Marshal.ReleaseComObject(_addressEntry); _addressEntry = null; } }
public ContactCard CreateContactCard (AddressEntry AddressEntry) { throw new NotImplementedException(); }
private string ResolveUserAddressEntry(AddressEntry ae) { string emailAddress = string.Empty; if (ae.AddressEntryUserType == OlAddressEntryUserType.olExchangeUserAddressEntry || ae.AddressEntryUserType == OlAddressEntryUserType.olExchangeRemoteUserAddressEntry) { var exchangeUser = ae.GetExchangeUser(); if (exchangeUser != null) { emailAddress = exchangeUser.PrimarySmtpAddress; Marshal.ReleaseComObject(exchangeUser); } } else { emailAddress = ae.Address; } return emailAddress; }
private List<string> ResoveExchangeDistributionList(AddressEntry ae) { var emailAddresses = new List<string>(); var distributionList = ae.GetExchangeDistributionList(); if (distributionList != null) { var members = distributionList.GetExchangeDistributionListMembers(); if (members != null) { for (int i = 1; i <= members.Count; i++) { var member = members[i]; emailAddresses.AddRange(ResolveAddressEntry(member)); Marshal.ReleaseComObject(member); } Marshal.ReleaseComObject(members); } Marshal.ReleaseComObject(distributionList); } return emailAddresses; }
private string GetContactLink(AddressEntry item) { return string.Format("<a onclick='' id='sender'>{0}</a>", item.Name); }