我需要從SharePoint打開Outlook郵件compaose編程,我想這代碼,但它只是打開Outlook的過程,但在撰寫郵件窗口沒有出現如何從2010年的SharePoint打開Outlook撰寫新郵件progamaticallly
using (SPSite currentSite = new SPSite(SPContext.Current.Site.ID))
{
using (SPWeb currentWeb = currentSite.OpenWeb(SPContext.Current.Web.ID))
{
WebURL = currentWeb.Url;
currentWeb.AllowUnsafeUpdates = true;
SPList correspondences = currentWeb.Lists.TryGetList("list1");
SPListItem correspondenceItem = correspondences.GetItemById(id);
WebURL = currentWeb.Url;
SPAttachmentCollection CorrespondenceAttachemt = correspondenceItem.Attachments;
Microsoft.Office.Interop.Outlook.Application oApp = new Microsoft.Office.Interop.Outlook.Application();
Microsoft.Office.Interop.Outlook._MailItem oMailItem = (Microsoft.Office.Interop.Outlook._MailItem)oApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);
oMailItem.Body = body;
oMailItem.Subject = title;
oMailItem.Display();
}
}
你可能會在'oMailItem.Display();'上得到一個異常。嘗試在代碼上附加斷點 – 2013-03-27 11:00:00
是的......錯誤是「Microsoft Exchange不可用,或者存在網絡問題或Exchange服務器因維護而關閉。」 – mahamed 2013-03-28 12:24:48