Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. ATL / WTL / STL
  4. listing Office contacts

listing Office contacts

Scheduled Pinned Locked Moved ATL / WTL / STL
helptutorial
9 Posts 2 Posters 3 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tasumisra
    wrote on last edited by
    #1

    Hi Guys, i want to list and check the status of each contact of my Office Communicator for this i have done till 1)i can see number of contact from get_count method 2)GetContact method is also successfully executed. and done know how to move further.. any help is appriciated..

    CoInitialize(NULL);
    HRESULT hr = CoCreateInstance(CLSID_Messenger,NULL,CLSCTX_LOCAL_SERVER,
    IID_IMessenger, (LPVOID *)&m_pIMessenger);

    BSTR myName;
    MISTATUS sMyStatus;
    
    //hr = m\_pIMessenger->get\_MyFriendlyName(&myName);
    hr=m\_pIMessenger->get\_MySigninName(&myName);
    hr = m\_pIMessenger->get\_MyStatus(&sMyStatus);
    
    BSTR serviceId;
    m\_pIMessenger->get\_MyServiceId(&serviceId);
    
    IDispatch \*pContacts;
    IMessengerContacts \*pCon;
      BSTR bstrServiceId;
    
          hr = m\_pIMessenger->get\_MyServiceId(&bstrServiceId);
    	
      if (FAILED(hr))
    	 return NULL;
    
    
    
      hr = m\_pIMessenger->GetContact(myName, bstrServiceId, 
                                     (IDispatch\*\*)&pCon);
    

    vikas da

    L 1 Reply Last reply
    0
    • T tasumisra

      Hi Guys, i want to list and check the status of each contact of my Office Communicator for this i have done till 1)i can see number of contact from get_count method 2)GetContact method is also successfully executed. and done know how to move further.. any help is appriciated..

      CoInitialize(NULL);
      HRESULT hr = CoCreateInstance(CLSID_Messenger,NULL,CLSCTX_LOCAL_SERVER,
      IID_IMessenger, (LPVOID *)&m_pIMessenger);

      BSTR myName;
      MISTATUS sMyStatus;
      
      //hr = m\_pIMessenger->get\_MyFriendlyName(&myName);
      hr=m\_pIMessenger->get\_MySigninName(&myName);
      hr = m\_pIMessenger->get\_MyStatus(&sMyStatus);
      
      BSTR serviceId;
      m\_pIMessenger->get\_MyServiceId(&serviceId);
      
      IDispatch \*pContacts;
      IMessengerContacts \*pCon;
        BSTR bstrServiceId;
      
            hr = m\_pIMessenger->get\_MyServiceId(&bstrServiceId);
      	
        if (FAILED(hr))
      	 return NULL;
      
      
      
        hr = m\_pIMessenger->GetContact(myName, bstrServiceId, 
                                       (IDispatch\*\*)&pCon);
      

      vikas da

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      I don't see the items you refer to in your code extract.

      Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman

      T 1 Reply Last reply
      0
      • L Lost User

        I don't see the items you refer to in your code extract.

        Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman

        T Offline
        T Offline
        tasumisra
        wrote on last edited by
        #3

        Thanks for the reply... Please find the complete code

        Quote:

        #include
        #include
        #include
        #include
        #include

        #include "c:\program files\Microsoft Office Communicator\SDK\msgrua.h"

        const GUID IID_IMessenger =
        {0xD50C3186,0x0F89,0x48f8,{0xB2,0x04,0x36,0x04,0x62,0x9D,0xEE,0x10}};

        const GUID CLSID_Messenger =
        {0x8885370D,0xB33E,0x44b7,{0x87,0x5D,0x28,0xE4,0x03,0xCF,0x92,0x70}};

        const GUID IID_MessengerContacts =
        {0xE7479A0F,0xBB19,0x44a5,{0x96,0x8F,0x6F,0x41,0xD9,0x3E,0xE0,0xBC}};

        const GUID IID_IEnumVARIANT =
        {0x00020404,0x0000,0x0000,{0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}};

        IMessenger* m_pIMessenger;

        IMessengerContact* GetContact(BSTR bstrSigninName);

        using namespace std;

        int _tmain(int argc, _TCHAR* argv[])
        {
        CoInitialize(NULL);
        HRESULT hr = CoCreateInstance(CLSID_Messenger,NULL,CLSCTX_LOCAL_SERVER,
        IID_IMessenger, (LPVOID *)&m_pIMessenger);

        BSTR myName;
        MISTATUS sMyStatus;

        //hr = m_pIMessenger->get_MyFriendlyName(&myName);
        hr=m_pIMessenger->get_MySigninName(&myName);
        hr = m_pIMessenger->get_MyStatus(&sMyStatus);

        BSTR serviceId;
        m_pIMessenger->get_MyServiceId(&serviceId);

        IDispatch *pContacts;
        IMessengerContacts *pCon;

        if (FAILED(hr))
        return NULL;

        hr = m_pIMessenger->GetContact(myName, serviceId,
        (IDispatch**)&pCon);
        if(FAILED(hr))
        {
        cout<<"Failed";
        }

        m_pIMessenger->get_MyContacts(&pContacts);
        pContacts->QueryInterface(__uuidof(IMessengerContacts),(void**)&pCon);

        long lCount=0;
        pCon->get_Count(&lCount);

        CoUninitialize();

        return 0;
        }

        Bow here i can see the count..now i want to iterate through each contact ..i am not getting right method to do the same.

        vikas da

        L 1 Reply Last reply
        0
        • T tasumisra

          Thanks for the reply... Please find the complete code

          Quote:

          #include
          #include
          #include
          #include
          #include

          #include "c:\program files\Microsoft Office Communicator\SDK\msgrua.h"

          const GUID IID_IMessenger =
          {0xD50C3186,0x0F89,0x48f8,{0xB2,0x04,0x36,0x04,0x62,0x9D,0xEE,0x10}};

          const GUID CLSID_Messenger =
          {0x8885370D,0xB33E,0x44b7,{0x87,0x5D,0x28,0xE4,0x03,0xCF,0x92,0x70}};

          const GUID IID_MessengerContacts =
          {0xE7479A0F,0xBB19,0x44a5,{0x96,0x8F,0x6F,0x41,0xD9,0x3E,0xE0,0xBC}};

          const GUID IID_IEnumVARIANT =
          {0x00020404,0x0000,0x0000,{0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}};

          IMessenger* m_pIMessenger;

          IMessengerContact* GetContact(BSTR bstrSigninName);

          using namespace std;

          int _tmain(int argc, _TCHAR* argv[])
          {
          CoInitialize(NULL);
          HRESULT hr = CoCreateInstance(CLSID_Messenger,NULL,CLSCTX_LOCAL_SERVER,
          IID_IMessenger, (LPVOID *)&m_pIMessenger);

          BSTR myName;
          MISTATUS sMyStatus;

          //hr = m_pIMessenger->get_MyFriendlyName(&myName);
          hr=m_pIMessenger->get_MySigninName(&myName);
          hr = m_pIMessenger->get_MyStatus(&sMyStatus);

          BSTR serviceId;
          m_pIMessenger->get_MyServiceId(&serviceId);

          IDispatch *pContacts;
          IMessengerContacts *pCon;

          if (FAILED(hr))
          return NULL;

          hr = m_pIMessenger->GetContact(myName, serviceId,
          (IDispatch**)&pCon);
          if(FAILED(hr))
          {
          cout<<"Failed";
          }

          m_pIMessenger->get_MyContacts(&pContacts);
          pContacts->QueryInterface(__uuidof(IMessengerContacts),(void**)&pCon);

          long lCount=0;
          pCon->get_Count(&lCount);

          CoUninitialize();

          return 0;
          }

          Bow here i can see the count..now i want to iterate through each contact ..i am not getting right method to do the same.

          vikas da

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          tasumisra wrote:

          now i want to iterate through each contact

          Use the Item[^] method. Note: please use <pre> tags round code not <blockquote>

          Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman

          T 1 Reply Last reply
          0
          • L Lost User

            tasumisra wrote:

            now i want to iterate through each contact

            Use the Item[^] method. Note: please use <pre> tags round code not <blockquote>

            Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman

            T Offline
            T Offline
            tasumisra
            wrote on last edited by
            #5

            Thanks Rich.. added

            IDispatch *ppContacts;
            hr=pCon->Item(0,&ppContacts);

            after that not getting any clue how to proceed further...any help ..i am just blank...

            vikas da

            L 1 Reply Last reply
            0
            • T tasumisra

              Thanks Rich.. added

              IDispatch *ppContacts;
              hr=pCon->Item(0,&ppContacts);

              after that not getting any clue how to proceed further...any help ..i am just blank...

              vikas da

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              tasumisra wrote:

              not getting any clue how to proceed further...any help ..i am just blank.

              Well I guess you need to iterate through the list from zero to the maximum value as indicated by the Count property.

              Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman

              T 1 Reply Last reply
              0
              • L Lost User

                tasumisra wrote:

                not getting any clue how to proceed further...any help ..i am just blank.

                Well I guess you need to iterate through the list from zero to the maximum value as indicated by the Count property.

                Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman

                T Offline
                T Offline
                tasumisra
                wrote on last edited by
                #7

                i tried that as above...

                hr=pCon->Item(0,&ppContacts);

                now ppContacts seems to be another interface with all COM predefined methods like Querry interface ,addref release etc.

                vikas da

                L 1 Reply Last reply
                0
                • T tasumisra

                  i tried that as above...

                  hr=pCon->Item(0,&ppContacts);

                  now ppContacts seems to be another interface with all COM predefined methods like Querry interface ,addref release etc.

                  vikas da

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #8

                  You really need to spend a lot more time reading the documentation on this interface before trying to implement it.

                  Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman

                  T 1 Reply Last reply
                  0
                  • L Lost User

                    You really need to spend a lot more time reading the documentation on this interface before trying to implement it.

                    Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman

                    T Offline
                    T Offline
                    tasumisra
                    wrote on last edited by
                    #9

                    Thank you so much Rich.. yes there is a need of going through the documentation.

                    vikas da

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups