c# VSTO Outlook.MeetingItem 读取会议开始日期
时间: 2023-07-27 16:23:02 浏览: 66
您可以使用以下代码来读取 Outlook 会议的开始日期:
```csharp
// 获取当前 Outlook 应用程序对象
Outlook.Application outlookApp = new Outlook.Application();
// 获取当前选定的会议对象
Outlook.MeetingItem meetingItem = (Outlook.MeetingItem)outlookApp.ActiveInspector().CurrentItem;
// 读取会议的开始日期
DateTime startDate = meetingItem.Start;
```
注意,上述代码假定您已经打开了一个会议对象,并且该对象是当前选定的对象。如果您需要打开一个特定的会议对象,可以使用以下代码:
```csharp
// 获取当前 Outlook 应用程序对象
Outlook.Application outlookApp = new Outlook.Application();
// 根据会议 ID 获取会议对象
Outlook.MeetingItem meetingItem = outlookApp.Session.GetItemFromID("会议 ID") as Outlook.MeetingItem;
// 读取会议的开始日期
DateTime startDate = meetingItem.Start;
```
请将上述代码中的“会议 ID”替换为您要打开的会议的实际 ID。
相关问题
c# VSTO Outlook.MeetingItem 读取会议开始日期, MeetingItem.Start没有找到代码
如果您想要读取 Outlook 中的会议开始日期,您可以使用 `Outlook.MeetingItem.StartUTC` 属性。这个属性会返回会议开始时间的 UTC 时间。您可以将其转换为本地时间,如下所示:
```csharp
Outlook.MeetingItem meetingItem = // 获取 MeetingItem 对象
// 获取会议开始时间的 UTC 时间
DateTime startUtc = meetingItem.StartUTC;
// 将 UTC 时间转换为本地时间
DateTime startLocal = startUtc.ToLocalTime();
```
如果您需要读取其他的会议属性,您可以在 `Outlook.MeetingItem` 类中查找相应的属性。
c# VSTO outlook获取会议预定信息
您可以使用 Microsoft.Office.Interop.Outlook 命名空间中的 AppointmentItem 类来获取 Outlook 中的会议预定信息。以下是一个示例代码:
```csharp
using Outlook = Microsoft.Office.Interop.Outlook;
// 获取 Outlook 应用程序对象
Outlook.Application outlookApp = new Outlook.Application();
// 获取当前用户的默认日历文件夹
Outlook.Folder calendar = outlookApp.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar) as Outlook.Folder;
// 获取所有会议预定项
Outlook.Items items = calendar.Items;
items.IncludeRecurrences = true;
items.Sort("[Start]");
// 遍历所有会议预定项
foreach (Outlook.AppointmentItem item in items)
{
// 判断是否为会议预定
if (item.MeetingStatus == Outlook.OlMeetingStatus.olMeeting)
{
// 获取会议预定信息
string subject = item.Subject;
string organizer = item.Organizer.Name;
DateTime start = item.Start;
DateTime end = item.End;
string location = item.Location;
string body = item.Body;
// 处理会议预定信息
// ...
}
}
```
注意:您需要在项目中引用 Microsoft.Office.Interop.Outlook.dll,并且需要安装 Outlook 应用程序。
相关推荐
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)