Outlook Addin Access Exchange Recipient Offline?

I am creating Outlook addin using VS 2008 and C #. In order to function, this addin goes through all emails using Redemption and analyzes it.

I recently ran into the problem of someone opening Outlook without a network connection (network disconnected, disconnected, or mobile like a laptop and has no connectivity at the moment). It seems to be getting a list of recipients.

  
    System.Runtime.InteropServices.COMException (0x80040115): Error in IAddrBook :: OpenEntry: MAPI_E_NETWORK_ERROR  
    Error: The connection to Microsoft Exchange is unavailable. Your network adapter does not have a default gateway.
    Component: Microsoft Exchange Address Book
        at Redemption.RDOAddressEntryClass.get_SMTPAddress ()

It happens inside this code:

    /// <summary>
    /// Retrieves a list of recipient addresses from an RDOMail object
    /// </summary>
    /// <param name="rdoItem">The email to analyze</param>
    /// <returns>A list of e-mail addresses</returns>
    protected List<string> GetRecipients(RDOMail rdoItem)
    {
        RDORecipients recipients = rdoItem.Recipients;
        List<string> recipientList = new List<string>();
        if (recipients != null && recipients.Count > 0)
        {
            for (int i = 1; i <= recipients.Count; i++)
            {
                RDOAddressEntry addressEntry = recipients[i].AddressEntry;
                if (addressEntry != null)
                {
                    string recipient = addressEntry.SMTPAddress;
                    recipient = recipient.Trim();
                    if (recipient != null && recipient != String.Empty)
                    {
                        recipientList.Add(recipient);
                    }

                    System.Runtime.InteropServices.Marshal.FinalReleaseComObject(addressEntry);
                    addressEntry = null;
                }
            }
        }

        if (recipients != null)
        {
            System.Runtime.InteropServices.Marshal.FinalReleaseComObject(recipients);
            recipients = null;
        }

        return recipientList;
    }

      

So the question is how to get email recipients without having to authenticate or authorize with Exchange and its death because there is no network connection?

EDIT: Alternatively - is there a way to cache smtp email addresses in Outlook so that if it goes offline later it doesn't need to resolve the email addresses?

+2


source to share


2 answers


I believe some of the store providers are wrappers around the core PST stores. Therefore, when accessing certain properties, the provider will try to synchronize with the remote server. You can stop this by deploying a vendor store.

Note: adding an item to the deployed store should not be persisted, for example, on the server (in the case of IMAP4).



More on the UnwrapStore property here on the Redemption website

+1


source


In most cases, the PR_SMTP_ADDRESS property should be available in the recipient table. You can access this property with RDORecipient.Fields [] - there is no reason to use RDORecipient.AddressEntry (which causes Redemption to call IAddrbook :: OpenEntry, and the call may fail offline).



Look at the Recipient Table with OutlookSpy (click IMessage, go to the GetRecipientTable tab) to verify that the PR_SMTP_ADDRESS property is present.

+1


source







All Articles