Third party application can list contacts from shared contacts folder, but not retrieve RRS feed

  • Question

  • I am working with a third party developer on a problem occurring in their application.<o:p></o:p>

    The software displays the contact list and retrieves a fax number from Outlook. I wish to
    return a number from an Outlook Shared Contacts Folder.

    This works well under Windows 7 with Outlook 2013 in cached mode..<o:p></o:p>

    Running the same software in a terminal services window on a Remote Desktop Server running
    Server 2008 R2 with Outlook in Online mode an error is produced when trying to
    do the same. The contact list is shown, but when the code tries to retrieve the
    displayed record there is the following error:<o:p></o:p>

    System.Runtime.InteropServices.COMException (0x80040201): The operation failed.
    at Microsoft.Office.Interop.Outlook.AddressEntry.GetContact()
    at Zetadocs.Outlook.OM.x664bc8bcf689f252.x36f18e7b3c08fff5()<o:p></o:p>

    If I open Outlook myself first, browse to People and click on the Shared Contacts Folder,
    then run the application, there is no error and everything works fine. It is as
    if starting Outlook from code is not loading all contact folder information.<o:p></o:p>

    Have you any suggestions on what may be causing this to happen and if I can do anything to cure this?<o:p></o:p>

    • Edited by Nigel Mayo Friday, December 19, 2014 9:13 AM
    Friday, December 19, 2014 9:13 AM

All replies

  • Please show the relevant snippets of the code.

    The error is MAPI_E_UNKNOWN_ENTRYID, which means the address entry refers to a contact that it cannot find.

    Dmitry Streblechenko (MVP)
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Friday, December 19, 2014 2:23 PM
  • Sorry to be away from this for so long.

    It looks like Outlook is not initializing shared folders when it starts.
    I confirmed this using the following code for the Outlook startup event:

    Private Sub Application_Startup()
        Dim olApp As Outlook.Application
        Dim nspNameSpace As Outlook.NameSpace
        Dim objTempFolder As Outlook.MAPIFolder
        Set olApp = ThisOutlookSession.Application
        Set nspNameSpace = olApp.GetNamespace("MAPI")

        For Each objTempFolder In nspNameSpace.Folders
        Next objTempFolder
    End Sub

    With this in place I do not need to go to People and click the shared folder, and the third party app has no problems retrieving.

    The third party app starts Outlook itself if it is not already running. In this scenario no events fire.

    So the question is: Is there a means of executing this code when the third party app starts Outlook?

    Thursday, February 19, 2015 10:59 AM
  • Hello Nigel,

    Try to use the MAPILogonComplete event instead. Does it work in that case?

    Anyway, I'd suggest creating a new forum thread for separate questions. Thus, forum readers may recognize questions and answers easily.

    Thursday, February 19, 2015 12:39 PM