Enable Calendar in Outlook

Source: Internet
Author: User

Actually ...... Through the Application of Outlook, we cannot directly access others' Calendar. So we need to access it in a circle.

[Csharp]
Using System;
Using System. Collections. Generic;
Using System. Linq;
Using System. Text;
Using Microsoft. Office. Tools. Ribbon;
Using Outlook = Microsoft. Office. Interop. Outlook;
Using System. Windows. Forms;
 
Namespace OutlookAddIn26
{
Public partial class Ribbon1
{
Private void ribbonupload load (object sender, RibbonUIEventArgs e)
{
 
}
 
Private void button#click (object sender, RibbonControlEventArgs e)
{
Outlook. Application objApplication = Globals. ThisAddIn. Application;
Outlook. Explorer objExplorer = objApplication. ActiveExplorer ();
Outlook. NavigationPane objNavigationPane = objExplorer. NavigationPane;
If (objNavigationPane. CurrentModule. NavigationModuleType = Outlook. OlNavigationModuleType. olModuleCalendar)
{
Outlook. CalendarModule objCalendarModule = objNavigationPane. Modules. GetNavigationModule (Outlook. OlNavigationModuleType. olModuleCalendar) as Outlook. CalendarModule;
Foreach (Outlook. NavigationGroup objNavigationGroup in objCalendarModule. NavigationGroups)
{
Foreach (Outlook. NavigationFolder objNavigationFolder in objNavigationGroup. NavigationFolders)
{
If (objNavigationFolder. DisplayName. IndexOf ("Bruce Song")> = 0)
{
Outlook. MAPIFolder objTargetCalendar = objNavigationFolder. Folder;
Foreach (Outlook. AppointmentItem objAppointimetItem in objTargetCalendar. Items)
{
If (objAppointimetItem. BusyStatus = Outlook. OlBusyStatus. olFree)
{
ObjAppointimetItem. Display ();
}
}
}
}
}
}
}
}
}

If you do not have the access permission, the Code www.2cto.com will fail.


From TX_OfficeDev's column

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.