実行中のOutlookインスタンスと通信(または新しいインスタンスを開始)するC#Office VSTOアドインを開発しました。Office VSTOアドイン可能なアクセス許可の問題 - HRESULT 0x80004004(E_ABORT)
Outlookのタスクや予定を作成しようとしているときに運転中止され(HRESULTからの例外:0x80004004(E_ABORT))
例外メッセージは以下の通りです...一部の顧客のPCにアクセス許可の問題を抱えて
Thここで起こっている:
Outlook.Account DefaultAccount = null;
Outlook.Application outlookApp = GetOutlookApp(); //returns Application object of running Outlook instance/creates a new instance - it works for them.
DefaultAccount = GetAccountForFolder(outlookApp); //returns the default account of the user. Tried it with a simple setup, only one account etc. - it works for them
String defaultemailaddress;
//CODE RUNS UNTIL THIS POINT
if (DefaultAccount == null) //if somehow this would end up NULL, which is not the case, because: see code snippet below!
{
defaultemailaddress = outlookApp.Session.CurrentUser.AddressEntry.Address;
}
else
{
defaultemailaddress = DefaultAccount.SmtpAddress; //this could be the problem, but I can't debug it further, and it works in the code block below, to get the AccountType, so I don't understand why I couldn't get the SmtpAddress without a hard exception
}
//FAILS BEFORE THIS LINE COULD RUN.
String email = "[email protected]";
ユーザーと接触して取得した後、彼らは本当に限られたアクセス許可セットとネットワークの下で実行していることを、私たちに語りました。
奇妙なことは、このコードのスニペットは、実際の接続がアドインOutlookおよびその他のOfficeの間で動作していることを、証明している、彼らのためにスムーズに実行されます。
Outlook.Application oApp = GetOutlookApp();
Outlook.Account DefaultAccount = GetAccountForFolder(oApp);
String AccountType = DefaultAccount.AccountType.ToString();
IT部門がすでに調整してみました影響を受けるPC上のOutlookのセキュリティポリシー彼らはプログラムによるアクセスを許可しました。
管理者権限でツールを起動することはできませんが、必要はありません。アプリケーションが実際に正しく起動していることが証明されていますが、特定の機能しか実行できないように見えます...
私はまた、彼らはExchangeを使用していますが、明らかに同期に関する問題はありません(これらが何かに影響を与える場合は...)。これは私が見つけたコードスニペットであり、うまくいきました。
public static Outlook.Account GetAccountForFolder(Outlook.Application outlookApp)
{
// Obtain the store on which the folder resides.
Outlook.Store store = outlookApp.Session.DefaultStore;
// Enumerate the accounts defined for the session.
foreach (Outlook.Account account in outlookApp.Session.Accounts)
{
// Match the DefaultStore.StoreID of the account
// with the Store.StoreID for the currect folder.
if (account.DeliveryStore.StoreID == store.StoreID)
{
// Return the account whose default delivery store
// matches the store of the given folder.
return account;
}
}
// No account matches, so return null.
return null;
}
GetAccountForFolderの実装について教えてください。 OutlookSpyで同じ問題を使用しますか? (名前空間ボタンをクリックし、アカウントを選択し、参照をクリックし、IEnumVariantタブに移動し、問題のアカウントをダブルクリックします)。 –
こんにちはドミトリー!どのようなOutlook関連のあなたの積極的な作業をありがとう、私は多くのあなたのコメント/回答が役立っているのを発見した! OutlookSpyをインストールしてこの調査に使用するようユーザーに依頼する必要があるということですか? – Laureant