Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get phone numbers from a "general" contact #250

Open
icalvete opened this issue Nov 9, 2016 · 0 comments
Open

Get phone numbers from a "general" contact #250

icalvete opened this issue Nov 9, 2016 · 0 comments

Comments

@icalvete
Copy link

icalvete commented Nov 9, 2016

Hi,

I have some code like this...

#!/usr/bin/env ruby

require 'viewpoint'
include Viewpoint::EWS

endpoint = 'https://whatever/ews/exchange.asmx'
user = 'myuser'
pass = 'mypass'

ews_client= Viewpoint::EWSClient.new endpoint, user, pass
contacts = ews_client.search_contacts 'israel calvete'

I can see this on my rails app log

DEBUG  Viewpoint::EWS::SOAP::ExchangeWebService : Sending SOAP Request:
----------------
<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">
  <soap:Header>
    <t:RequestServerVersion Version="Exchange2010"/>
  </soap:Header>
  <soap:Body>
    <ResolveNames xmlns="http://schemas.microsoft.com/exchange/services/2006/messages" ReturnFullContactData="true">
      <UnresolvedEntry>israel calvete</UnresolvedEntry>
    </ResolveNames>
  </soap:Body>
</soap:Envelope>
----------------

DEBUG  Viewpoint::EWS::Connection : Received SOAP Response:
----------------
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header>
    <h:ServerVersionInfo xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" MajorVersion="14" MinorVersion="3" MajorBuildNumber="158" MinorBuildNumber="1" Version="Exchange2010_SP2"/>
  </s:Header>
  <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <m:ResolveNamesResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<m:ResponseMessages>
  <m:ResolveNamesResponseMessage ResponseClass="Success">
    <m:ResponseCode>NoError</m:ResponseCode>
    <m:ResolutionSet TotalItemsInView="1" IncludesLastItemInRange="true">
      <t:Resolution>
        <t:Mailbox>
          <t:Name>Israel Calvete</t:Name>
          <t:EmailAddress>[email protected]</t:EmailAddress>
          <t:RoutingType>SMTP</t:RoutingType>
          <t:MailboxType>Mailbox</t:MailboxType>
        </t:Mailbox>
        <t:Contact>
          <t:DisplayName>Israel Calvete</t:DisplayName>
          <t:Culture>en-US</t:Culture>
          <t:GivenName>Israel</t:GivenName>
          <t:EmailAddresses>
            <t:Entry Key="EmailAddress1">X400:C=US;A= ;P=IKUSI;O=IKUSIMAIL;S=Calvete;G=Israel;</t:Entry>
            <t:Entry Key="EmailAddress2">SMTP:[email protected]</t:Entry>
          </t:EmailAddresses>
          <t:PhoneNumbers>
            <t:Entry Key="BusinessPhone">943447172</t:Entry>
            <t:Entry Key="HomePhone">985478425</t:Entry>
            <t:Entry Key="MobilePhone">689542185</t:Entry>
            <t:Entry Key="Pager">68451</t:Entry>
          </t:PhoneNumbers>
          <t:ContactSource>ActiveDirectory</t:ContactSource>
          <t:Surname>Calvete</t:Surname>
        </t:Contact>
      </t:Resolution>
    </m:ResolutionSet>
  </m:ResolveNamesResponseMessage>
</m:ResponseMessages>
    </m:ResolveNamesResponse>
  </s:Body>
</s:Envelope>
----------------

As you can see, there are come "PhoneNumbers" within the response but since search_contacts return an array of Types::MailboxUser I don't have access to those phones.

contacts.first.methods told me that before.

There is any way to get those phones?

I read the line 168 from https://github.com/WinRb/Viewpoint/blob/master/lib/ews/types/item_field_uri_map.rb, but I can't figure out how to use it ( Even is possible to use it with my purpose)

I think is only usefull with a folder with contacts instead "general" contatcs.

Although is no my goal, I have created I a contact in this folder. Anyway, an Viewpoint::EWS::Types::Contact don't have access to those phones.

Any idea?

Thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant