c#在另一个默认日历中添加会议请求

c#在另一个默认日历中添加会议请求,c#,outlook,calendar,C#,Outlook,Calendar,我想向某些机构发送会议请求(列表中的邮件)。 会议不能在默认日历中。它需要位于(fullpathCalendar)“\\Methode\Calendar”中 这就是我到目前为止所做的: Outlook.Application OutlookApp = new Outlook.Application(); // Change the session or calendar ? Outlook.AppointmentItem appt = (Outlook.AppointmentItem)

我想向某些机构发送会议请求(列表中的邮件)。 会议不能在默认日历中。它需要位于
(fullpathCalendar)“\\Methode\Calendar”

这就是我到目前为止所做的:

Outlook.Application OutlookApp = new Outlook.Application();
// Change the session or calendar ? 
 Outlook.AppointmentItem appt = (Outlook.AppointmentItem)
       OutlookApp.CreateItem(Outlook.OlItemType.olAppointmentItem);

appt.Subject = "";
appt.MeetingStatus = Outlook.OlMeetingStatus.olMeeting;
appt.Location = "";
appt.Start = DateTime.Now.AddHours(2);
appt.End = DateTime.Now.AddHours(3);
appt.AllDayEvent = false;
appt.Body = "sdfsdfsdfdsfsfdsfdsfsfsfdsfsfsdfsd";

如何将约会分配到该日历?

对于需要相同约会的人:

        string sendText = "";
        string subject = "";
        string location = "";
        string emails = {"dsqdsqdqsd@dsqdqd.com", "sdqdqdqd@dqsd.com"};
        Microsoft.Office.Interop.Outlook.Application app = new Microsoft.Office.Interop.Outlook.Application();
        Outlook.AppointmentItem appt = (Outlook.AppointmentItem)app.CreateItem(Outlook.OlItemType.olAppointmentItem);

        appt.Subject = subject;
        appt.MeetingStatus = Outlook.OlMeetingStatus.olMeeting;
        appt.Location = location;
        appt.Start = DateTime.Now.AddHours(1);
        appt.End = DateTime.Now.AddHours(3);
        appt.AllDayEvent = false;
        appt.Body = sendText;
        appt.ResponseRequested = false;

        foreach (string email in emails)
        {
            Outlook.Recipient recipRequired = appt.Recipients.Add(email);
            recipRequired.Type = (int)Outlook.OlMeetingRecipientType.olRequired;
        }

        appt.Recipients.ResolveAll();
        appt.Display(true);

        try
        {
            Outlook.MAPIFolder calendar = Data.OutlookHelper.AdxCalendar.getCallendar(app, @"\\Fichier de données Outlook\Calendrier\Methode");
            appt.Move(calendar);
        }
        catch
        {
            Dialogs.Alert alert = new Dialogs.Alert("Erreur", "Le rendez-vous est introuvable, vous l'avez peut-être supprimer.");
            alert.ShowDialog();
        }
和my Data.OutlookHelper.AdxCalendar:

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text.RegularExpressions;
using System.Windows;
using System.Windows.Controls;
using Outlook = Microsoft.Office.Interop.Outlook;

namespace Data.OutlookHelper
{
    public class AdxCalendar
    {
        public static Outlook.MAPIFolder getCallendar(Outlook.Application OutlookApp, string path)
        {
            Outlook.MAPIFolder calendar = null;
            foreach (Outlook.Store store in OutlookApp.Session.Stores)
            {
                if (store.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar).FullFolderPath.Equals(path))
                {
                    calendar = store.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar);
                    break;
                }
                foreach (Outlook.MAPIFolder folder in store.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar).Folders)
                {
                    if (folder.FullFolderPath.Equals(path))
                    {
                        calendar = folder;
                        break;
                    }
                }
                if (calendar != null)
                    break;
            }
            if (calendar == null)
            {
                return null;
            }
            return calendar;
        }
    }
}

可能类似于
var calendar=OutlookApp.GetFolderPath(“path\calendarname”)
然后是
appt.Move(calendar)
?为什么我从来没有看到过?它工作得很好。谢谢@stuartdDo你知道如何强迫被邀请者接受会议吗?一根有钉子的大棒?我不认为你会被允许按程序那样做,除非你可以,我可以,但我不想。我在Campanile网站上看到的。当我预订房间时,他们给我发来了一个会议,这不是一个要求。不需要回答,这已经作为一个任命出现在我的日程表上了。Outlook参数中没有任何内容?有共享日历的设置吗?