Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在outlook上设置与其他用户的约会?_C#_Email_Outlook - Fatal编程技术网

C# 如何在outlook上设置与其他用户的约会?

C# 如何在outlook上设置与其他用户的约会?,c#,email,outlook,C#,Email,Outlook,假设我使用管理员帐户登录到操作系统,并且有权设置与其他用户的约会,而无需发送邮件 我如何在代码中实现它? 我只能找到使用ApportmentItem的示例,并将约会设置为本地计算机的outlook。如何为外部用户执行此操作 非常感谢 private static void AddAppointment() { Outlook.Application outlookApp = new Outlook.Application(); // creates n

假设我使用管理员帐户登录到操作系统,并且有权设置与其他用户的约会,而无需发送邮件

我如何在代码中实现它? 我只能找到使用ApportmentItem的示例,并将约会设置为本地计算机的outlook。如何为外部用户执行此操作

非常感谢

    private static void AddAppointment()
    {


            Outlook.Application outlookApp = new Outlook.Application(); // creates new outlook app
            Outlook.AppointmentItem oAppointment =
                (Outlook.AppointmentItem) outlookApp.CreateItem(Outlook.OlItemType.olAppointmentItem);
                // creates a new appointment

            oAppointment.Subject = "Enquiry Changes made to john enquiry"; // set the subject
            oAppointment.Body = "This is where the appointment body of the appointment is written"; // set the body
            oAppointment.Location = "Nicks Desk!"; // set the location
            oAppointment.Start = DateTime.Now.AddHours(2);
            oAppointment.End = DateTime.Now.AddHours(3);
            oAppointment.ReminderSet = true; // Set the reminder
            oAppointment.ReminderMinutesBeforeStart = 15; // reminder time
            oAppointment.Importance = Outlook.OlImportance.olImportanceHigh; // appointment importance
            oAppointment.BusyStatus = Outlook.OlBusyStatus.olBusy;
            oAppointment.Save();
            Outlook.MailItem mailItem = oAppointment.ForwardAsVcal();
    }

使用Namespace.GetSharedDefaultFolder()打开其他用户的日历文件夹,然后使用MAPIFolder.Items.Add创建约会。

您是否已尝试过任何操作?如果是,请展示你所做的。至少要向我们展示您正在考虑的API。如果没有它,此问题将被关闭,原因可能是范围太广,或是寻找推荐的非现场资源,或是缺少问题代码。谢谢-我已将其添加到原始邮件中。如果您需要在他们的日历中设置内容而不向他们发送邀请,则需要与服务器对话(因此,可能是Exchange)而不是Outlook。使用本地Outlook所能做的就是向他们发送邀请(即邮件)。如果您可以向他们发送某些内容(您的ForwardAsVcal建议,即使您的主要文本建议不是这样),则您必须对该邮件项目执行某些操作!(例如发送)。但我如何才能将其发送到其他用户的exchange?目前,此代码在我的exchange上设置了一个约会…我不确定模拟是否是Outlook API中的一个功能,它在一些Google搜索中看起来不像。如果你有该用户的凭据,你可以执行一个简单的
runas
。但听起来更像是你实际上在尝试使用Impersonation,它是(例如)Exchange Web服务API的一部分。请搜索
ExchangeService.ImpersonatedUserId
以开始。谢谢!此处的链接很棒: