के लिए एप्लिकेशन-स्तर एड-इन डीबग नहीं कर सकता है यह पहली बार है जब मैं Outlook के लिए अनुप्रयोग-स्तर एड-इन बनाने के लिए .NET का उपयोग कर रहा हूं। एक ट्यूटोरियल का उपयोग करके मैंने कुछ कोड लिखा और इसे सफलतापूर्वक बनाया गया, लेकिन मैं कोड डीबग करने में असमर्थ था। एक चेतावनी बॉक्स डिबग करने के दौरान कहता है:Outlook
आप इस प्रोजेक्ट को चला या डिबग नहीं कर सकते क्योंकि माइक्रोसॉफ्ट एप्लिकेशन का आवश्यक संस्करण स्थापित नहीं है।
मैं विजुअल स्टूडियो 2010 और एमएस ऑफिस 2007 उपयोग कर रहा हूँ। कोड डीबग करने के लिए मैं क्या करूँगा? क्या मैं कोड में कोई बदलाव कर सकता हूं ताकि मैं इसे डीबग कर सकूं।
यहाँ कोड
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using Outlook = Microsoft.Office.Interop.Outlook;
using Office = Microsoft.Office.Core;
using Microsoft.Office.Interop.Outlook;
namespace OutlookAddIn1
{
public partial class ThisAddIn
{
Outlook.Inspectors inspectors;
event InspectorsEvents_NewInspectorEventHandler NewInspector;
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
inspectors = this.Application.Inspectors;
inspectors.NewInspector +=
new Microsoft.Office.Interop.Outlook.InspectorsEvents_NewInspectorEventHandler(Inspectors_NewInspector);
}
private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
{
}
void Inspectors_NewInspector(Microsoft.Office.Interop.Outlook.Inspector Inspector)
{
Outlook.MailItem mailItem = Inspector.CurrentItem as Outlook.MailItem;
if (mailItem != null)
{
if (mailItem.EntryID == null)
{
mailItem.Subject = "This text was added by using code";
mailItem.Body = "This text was added by using code";
}
}
}
#region VSTO generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InternalStartup()
{
this.Startup += new System.EventHandler(ThisAddIn_Startup);
this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
}
#endregion
}
}
एमएस ऑफिस 2016 के लिए, संस्करण संख्या "16.0" है। –