public IEnumerable <ChannelContact> GetContacts() { var client = new ExchangeClient(Hostname, CredentialsProvider); foreach (var contactItem in client.GetContacts()) { if (contactItem.EmailAddresses == null || contactItem.EmailAddresses.Length == 0) { Logger.Warn("Contact {0} had no email address, ignoring", LogSource.Sync, contactItem.DisplayName); continue; } var contact = new ChannelContact(); contact.Profile.ChannelProfileKey = contactItem.ItemId.Id; contact.Profile.SourceAddress = new SourceAddress(contactItem.EmailAddresses[0].Value, contactItem.DisplayName); contact.Person.Lastname = contactItem.Surname; contact.Person.Firstname = contactItem.GivenName; if (contactItem.BirthdaySpecified) { contact.Person.DateOfBirth = contactItem.Birthday; } contact.Profile.ScreenName = contactItem.Nickname; contact.Profile.Title = contactItem.JobTitle; contact.Profile.ScreenName = contactItem.DisplayName; contact.Profile.CompanyName = contactItem.CompanyName; if (contactItem.PhysicalAddresses.Length > 0) { contact.Profile.Street = contactItem.PhysicalAddresses[0].Street; contact.Profile.ZipCode = contactItem.PhysicalAddresses[0].PostalCode; contact.Profile.City = contactItem.PhysicalAddresses[0].City; contact.Profile.Country = contactItem.PhysicalAddresses[0].CountryOrRegion; } yield return(contact); } }
public Resp Process(Req request) { try { WebServiceTracer.TracerId = request.Tracer; WebServiceTracer.UserId = request.UserId; request.Validate(); return(ProcessCore(request)); } catch (UserFriendlyException ex) { Logger.Warn("Service handler threw an exception. Exception = {0}", LogSource.Sync, ex); Resp response = new Resp(); response.Result = new Result(); response.Result.ResultCode = -1; response.Result.ResultText = ex.Message; return(response); } catch (Exception ex) { Logger.Warn("Service handler threw an exception. Exception = {0}", LogSource.Sync, ex); Resp response = new Resp(); response.Result = new Result(); response.Result.ResultCode = -1; response.Result.ResultText = "A general processing error has occured."; return(response); } }