本文介绍了WindowsFormsApplication1.Form1'不包含'Application'的定义,也没有扩展方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已使用示例代码为日期创建日历,但上述错误即将到来
使用系统.Runtime.InteropServices;
使用Outlook = Microsoft.Office.Interop.Outlook;
private void AddAppointment()
      {
         试试
          {
           
              Outlook.AppointmentItem newAppointment =
                  (Outlook.AppointmentItem)
              this.Application.CreateItem(Outlook.OlItemType.olAppointmentItem);
              newAppointment.Start = DateTime.Now.AddHours(2);
              newAppointment.End = DateTime.Now.AddHours(3);
              newAppointment.Location =" ConferenceRoom#2345";
              newAppointment.Body =
                  "我们将讨论小组项目的进展情况。"; $
              newAppointment.AllDayEvent = false;
              newAppointment.Subject =" Group Project"; $
              newAppointment.Recipients.Add(" Roger Harui");
              Outlook.Recipients sentTo = newAppointment.Recipients;
              Outlook.Recipient sentInvite = null;
              sentInvite = sentTo.Add("Holly Holt");
              sentInvite.Type =(int)Outlook.OlMeetingRecipientType
                  .olRequired;
              sentInvite = sentTo.Add(" David Junca");
              sentInvite.Type =(int)Outlook.OlMeetingRecipientType
                  .olOptional;
              sentTo.ResolveAll();
              newAppointment.Save();
              newAppointment.Display(true);
          }¥b $ b           catch(例外情况)
          {
              MessageBox.Show("发生以下错误:" + ex.Message);
          }¥b $ b       }
以下错误即将发生
'WindowsFormsApplication1.Form1'不包含'Application'的定义并且没有扩展方法'Application'接受类型为'WindowsFormsApplication1.Form1'的第一个参数'(您是否缺少using指令或汇编引用?)
请帮助
polachan
解决方案
这篇关于WindowsFormsApplication1.Form1'不包含'Application'的定义,也没有扩展方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!