2014-02-28 20 views
1

我有一個Outlook加載項可以爲大約100個用戶成功運行。它與我們的應用程序交互並創建/更新任務和約會項目。但是,一個客戶端無法爲任何不是網絡管理員的人員工作。通過一些日誌記錄,我可以看到它工作正常,直到它到達應該保存任務的部分,然後它引發臭名昭着的「操作失敗」。錯誤。我試圖通過調查內部異常等來獲得更多錯誤細節,但是「操作失敗」。是我看起來能夠擺脫它的一切。Outlook 2010 VSTO - 非管理員用戶收到「操作失敗。」當Task.Save被稱爲

爲了使調試更簡單,我從圖片中刪除了我們的應用程序,併爲他們寫了一個測試插件,它只創建了9個任務(硬編碼爲「任務1」,「任務2」等)和它在相同的地方出現同樣的錯誤失敗。我要求他們寫一個宏來看看一個宏是否可以爲這些用戶創建任務。我正在等待他們的答覆。

無論如何,我已經在MSDN上試了一個多月,試圖在這個問題上得到幫助,沒有人能夠提供幫助。我希望這裏有人能夠說出一些光明。如果您可以提供有關可能發生的事情的任何見解或幫助我追蹤問題的建議,將不勝感激!

這是我使用創建的測試加載樣本任務的功能:

private void CreateTasks() 
{ 
    int i = 1; 
    Outlook.TaskItem t = null; 
    Outlook.UserProperties ups = null; 
    Outlook.UserProperty up = null; 
    string name = string.Empty; 

    while (i < 10) 
    { 
     name = string.Format("Task {0}", i.ToString()); 

     t = Application.CreateItem(Outlook.OlItemType.olTaskItem); 

     t.Subject = name; 
     t.Status = Outlook.OlTaskStatus.olTaskNotStarted; 
     t.Body = string.Format("Task {0} description", i.ToString()); 
     t.Categories = "Test Task"; 
     t.Importance = Outlook.OlImportance.olImportanceNormal; 
     t.ActualWork = 0; 
     t.TotalWork = 5 * 60; 

     //mimic dates that might come in main add-in 
     DateTime st = Convert.ToDateTime("12/10/2013"); 
     st = st.AddDays(i); 
     t.StartDate = st; 

     DateTime end = Convert.ToDateTime("01/02/2014"); 
     end = end.AddDays(i); 
     string EP = end.ToShortDateString() + " 5:00:00 PM"; 
     end = Convert.ToDateTime(EP); 
     t.DueDate = end; 

     //mimic how we keep track of our items in the main add-in 
     ups = t.UserProperties; 
     up = ups.Find("ID"); 
     if (up == null) 
     { 
      up = ups.Add("ID", Outlook.OlUserPropertyType.olText); 
     } 
     up.Value = string.Format("ID {0}", i.ToString()); 

     //This is where the "The Operation Failed." error occurs on every single task. 
     try 
     { 
      ((Outlook._TaskItem)t).Save(); 
     } 
     catch (Exception ex) 
     { 
      //logs message to file 
     } 

     //Release objects 
     if (up != null) Marshal.ReleaseComObject(up); 
     if (t != null) Marshal.ReleaseComObject(t); 

     i++; 
    } 
    GC.Collect(); 
} 

回答

0

根據MSDN:

Saves the Microsoft Outlook item to the current folder or, 
if this is a new item, to the Outlook default folder for the item type. 

,那麼「非管理員用戶」訪問到這個文件夾?

我會對衝一個賭注,這是與Access權限有關。這將是第一個開始的地方。

0

這是在Exchange郵箱嗎?在連接到服務器變得不穩定之前,我已經看到了這個錯誤。如果是,請查看從緩存模式切換到在線模式時是否發生錯誤。我不認爲這是一個代碼問題。

相關問題