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

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了c#在默认的另一个日历中添加会议请求相关的知识,希望对你有一定的参考价值。

我想向某些人发送会议请求(列表中的邮件)。会议不能在默认日历中。它需要在(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();
        }

和我的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;
        }
    }
}

以上是关于c#在默认的另一个日历中添加会议请求的主要内容,如果未能解决你的问题,请参考以下文章

如何在Bluemix Node-Red Application中发送会议邀请(日历)[关闭]

尝试通过交换 api 在交换日历上创建会议时出错

如何在PHP中创建Outlook日历会议请求?

在 Java 的 GraphQL 查询中添加片段

请问如何设置日历的重复项目呢

有没有办法添加 webex 会议以使用谷歌日历 api?