View.GoToDate(DateTime) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Changes the date used by the current view to display information.
public:
void GoToDate(DateTime Date);
public void GoToDate (DateTime Date);
Public Sub GoToDate (Date As DateTime)
Parameters
- Date
- DateTime
The date to which the view should be changed.
Remarks
To specify a date to go to in a current view, such as a CalendarView object, you should first obtain a View object for the current view by using CurrentView instead of CurrentView. The following code sample demonstrates how to perform this action.
Sub TestGoToDate()
Dim oCV As Outlook.CalendarView
Dim oExpl As Outlook.Explorer
Dim datGoTo As Date
datGoTo = "11/7/2005"
' Display the contents of the Calendar default folder.
oExpl = Application.Explorers.Add( _
Application.Session.GetDefaultFolder( -
Outlook.OlDefaultFolders.olFolderCalendar), _
Outlook.OlFolderDisplayMode.olFolderDisplayFolderOnly)
oExpl.Display()
' Retrieve the current view by calling the
' CurrentView property of the Explorer object.
oCV = oExpl.CurrentView
' Set the CalendarViewMode property of the
' current view to display items by day.
oCV.CalendarViewMode = Outlook.OlCalendarViewMode.olCalendarViewDay
' Call the GoToDate method to set the date
' for which information is displayed in the view.
oCV.GoToDate(datGoTo)
End Sub
private void TestGoToDate()
{
Outlook.CalendarView oCV;
Outlook.Explorer oExpl;
System.DateTime datGoTo;
datGoTo = DateTime.Parse("11/7/2005");
// Display the contents of the Calendar default folder.
oExpl = Application.Explorers.Add(
Application.Session.GetDefaultFolder(
Outlook.OlDefaultFolders.olFolderCalendar),
Outlook.OlFolderDisplayMode.olFolderDisplayFolderOnly);
oExpl.Display();
// Retrieve the current view by calling the
// CurrentView property of the Explorer object.
oCV = (Outlook.CalendarView)(oExpl.CurrentView);
// Set the CalendarViewMode property of the
// current view to display items by day.
oCV.CalendarViewMode =
Outlook.OlCalendarViewMode.olCalendarViewDay;
// Call the GoToDate method to set the date
// for which information is displayed in the view.
oCV.GoToDate(datGoTo);
}
Applies to
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應