NetOfficeFw / NetOffice

🌌 Create add-ins and automation code for Microsoft Office applications.
MIT License
700 stars 145 forks source link

AddressEntry.Members.Add fails #398

Closed bob-zscharnagk closed 5 months ago

bob-zscharnagk commented 1 year ago

The following code fails on the ae.Members.Add statement with

Failed to proceed Method on Outlook.AddressEntries=>Add. Exception has been thrown by the target of an invocation. An attempt was made to open an unsupported property.

            NetOffice.OutlookApi.Application oApp = new NetOffice.OutlookApi.Application();
            foreach (AddressList al in oApp.GetNamespace("MAPI").AddressLists)
            {
                foreach (AddressEntry ae in al.AddressEntries)
                {
                    if (ae.Name == "MPTC members" && ae.Type == "MAPIPDL")
                    {
                        ae.Members.Add("SMTP", "Bob", "someone@somewhere.com");
                    }
                }
            }

Any ideas?