I want to create a button in an outlook VSTO addin that when clicked, will show the users outlook calendar week view and i want to pass in a date that will drive what week it show.
Is this possible in C# outlook vsto to programatically changes the users view?
C operators are one of the features in C which has symbols that can be used to perform mathematical, relational, bitwise, conditional, or logical manipulations. The C programming language has a lot of built-in operators to perform various tasks as per the need of the program.
The bitwise OR assignment operator ( |= ) uses the binary representation of both operands, does a bitwise OR operation on them and assigns the result to the variable.
In C programming language, %d and %i are format specifiers as where %d specifies the type of variable as decimal and %i specifies the type as integer. In usage terms, there is no difference in printf() function output while printing a number using %d or %i but using scanf the difference occurs.
Create a new button and on its on click event use the CurrentView property of the Explorer class.
Information from MSDN states regarding Views:
The View object allows you to create customizable views that allow you to better sort, group and ultimately view data of all different types. There are a variety of different view types that provide the flexibility needed to create and maintain your important data.
- The table view type (olTableView) allows you to view data in a simple field-based table.
- The Calendar view type (olCalendarView) allows you to view data in a calendar format.
- The card view type (olCardView) allows you to view data in a series of cards. Each card displays the information contained by the item
and can be sorted.- The icon view type (olIconView) allows you to view data as icons, similar to a Windows folder or explorer.
- The timeline view type (olTimelineView) allows you to view data as it is received in a customizable linear time line.
You'll want to use olCalendarView
which is defiened and customized using the View object's XML property. The XML property allows you to create and set a customized XML schema that defines the various features of a view
Then you can set the date you want (in case your current view is calendar view) -
Outlook.Explorer olkExplorer = Application.ActiveExplorer();
DateTime selectedDate = DateTime.Now.AddDays(5);
if (olkExplorer.CurrentView is Outlook.CalendarView)
{
Outlook.CalendarView olkCalendarView = olkExplorer.CurrentView as Outlook.CalendarView;
olkCalendarView.GoToDate(selectedDate);
}
I hope it supports your question.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With