1

カレンダーを選択してそこからすべての予定を取得できる Outlook 2010 アドインを作成しようとしています。

既定の Office カレンダーを選択するのではなく、その名前で自分で作成したカレンダーを選択するにはどうすればよいですか?

4

1 に答える 1

0
public static Items GetAppointmentsInRange(MAPIFolder mAPIFolder, DateTime startTime, DateTime endTime)
{
    string filter = string.Format("[Start] >= '{0}' AND [End] <= '{1}'", startTime.ToString("g"), endTime.ToString("g"));
    Items calItems = mAPIFolder.Items.Restrict(filter);             
    calItems.Sort("[Start]", Type.Missing);
    return calItems;
}

public static MAPIFolder GetTimeTrackingCalendar()
{
    MAPIFolder result = null;
    MAPIFolder calendars = (MAPIFolder)outlook.ActiveExplorer().Session.GetDefaultFolder(OlDefaultFolders.olFolderCalendar);
    for (int i = 1; i <= calendars.Folders.Count; i++)
    {
        if (calendars.Folders[i].Name != Constants.TIME_TRACKING_CALENDAR) continue;
        result = calendars.Folders[i];
        break;
    }
    return result;
}

public static Items FindDeveloperTimeForDates(DateTime beginDate, DateTime endDate)
{
    return OutlookApp.GetAppointmentsInRange(OutlookApp.GetTimeTrackingCalendar(), beginDate, endDate);

}
于 2014-04-02T12:21:40.263 に答える