We developed a VSTO Office C # Office add-in that interacts with an executable instance of Outlook (or launches a new one), and it shows signs of resolving problems on some client computers when trying to create Outlook or destination tasks ...
Exception Message:
Operation canceled (exception from HRESULT: 0x80004004 (E_ABORT))
This is happening here:
Outlook.Account DefaultAccount = null;
Outlook.Application outlookApp = GetOutlookApp();
DefaultAccount = GetAccountForFolder(outlookApp);
String defaultemailaddress;
if (DefaultAccount == null)
{
defaultemailaddress = outlookApp.Session.CurrentUser.AddressEntry.Address;
}
else
{
defaultemailaddress = DefaultAccount.SmtpAddress;
}
String email = "test@emailserver.com";
After contacting the user, they told us that they work under a very limited set of permissions and a network.
It’s strange that this piece of code works fine for them, which proves that the connection works between Outlook and another Office add-in:
Outlook.Application oApp = GetOutlookApp();
Outlook.Account DefaultAccount = GetAccountForFolder(oApp);
String AccountType = DefaultAccount.AccountType.ToString();
- Outlook . .
, . , 3 ( ), , , , ...
, Exchange, , , ( - ...)
EDIT:
GetAccountForFolder, Outlook.Account . , , , .
public static Outlook.Account GetAccountForFolder(Outlook.Application outlookApp)
{
Outlook.Store store = outlookApp.Session.DefaultStore;
foreach (Outlook.Account account in outlookApp.Session.Accounts)
{
if (account.DeliveryStore.StoreID == store.StoreID)
{
return account;
}
}
return null;
}