使用VSTO把Groove和Outlook的约会进行同步(转)
Sync Outlook Appointments with Groove using VSTO
Both Outlook and Groove contain calendars so which one do you use? Each one has its own strengths but it would be cool to be able to sync your appointments. I have created a small sample using VSTO and the Groove SDK that will allow you to import and export appointments from Outlook to Groove. I started in my last post, Groove'n with VSTO, where I showed you how to connect to Groove using webservices. Now I will continue with the sample application and add support for importing Calendar items.
First I created a Ribbon for the Appointment inspector that allows you to choose the account and workspace you want to pull the calendar from.
Most of this code for the above screens was in the last post so I wont' go over it again, although I did refactor it quite a bit as I went along. The next this is to click "Add from Groove" to select an appointment to import.
I created the calendar picker to let you select the day with appointments, in bold, and then the entry for that day.
Click Import to import the Groove appointment into outlook.
Here is the Groove appointment
Now imported into Outlook.
After you get a reference to the Groove workspace you can interate through the tools until you find the calendar tools.
public static List<GrooveTools.Tool> Tools(GrooveSpaces.Space workspace) { GrooveTools.GrooveTools tools = new GrooveServices.GrooveTools.GrooveTools(); tools.GrooveRequestHeaderValue = new GrooveServices.GrooveTools.GrooveRequestHeader(); tools.GrooveRequestHeaderValue.GrooveIdentityURL = workspace.IdentityURL; tools.GrooveRequestHeaderValue.GrooveRequestKey = RequestKey; tools.Url = HostPortAddress + workspace.Tools; List<GrooveTools.Tool> toolsList = new List<GrooveServices.GrooveTools.Tool>(); toolsList.AddRange(tools.Read()); return toolsList; }
public static List<GrooveCalendar.GrooveCalendar> Calendars(GrooveSpaces.Space workspace) { List<GrooveCalendar.GrooveCalendar> calendars = new List<GrooveCalendar.GrooveCalendar>(); string calendarType = "urn:groove.net:platform.tools.Calendar"; foreach (GrooveTools.Tool tool in Tools(workspace)) { if (tool.Type == calendarType) { GrooveCalendar.GrooveCalendar calendar = new GrooveServices.GrooveCalendar.GrooveCalendar(); calendar.GrooveRequestHeaderValue = new GrooveServices.GrooveCalendar.GrooveRequestHeader(); calendar.GrooveRequestHeaderValue.GrooveIdentityURL = workspace.IdentityURL; calendar.GrooveRequestHeaderValue.GrooveRequestKey = RequestKey; calendar.Url = HostPortAddress + tool.Data; calendars.Add(calendar); } } return calendars; }
Now I just show the calendar picker and populate the outlook appointment. One thing I don't deal with yet in this sample is the fact that you could have mulitple calendar tools in a workspace. But it should be easy enough to just add another drop down to let the user pick the calendar.
//Show the Calendar entries
foreach (GrooveServices.GrooveCalendar.GrooveCalendar calendar in
GrooveServices.GrooveHelper.Calendars(workspace))
{
GrooveCalendarPicker gcp = new GrooveCalendarPicker(calendar);
gcp.ShowDialog();
if (gcp.calendarEntriesListBox.SelectedIndex >= 0)
{
GrooveServices.GrooveCalendar.CalendarEntry calEntry =
(GrooveServices.GrooveCalendar.CalendarEntry)gcp.calendarEntriesListBox.SelectedItem;
appointment.Subject = calEntry.Description;
appointment.Start = calEntry.Start;
appointment.End = calEntry.End;
appointment.Body = calEntry.Details;
appointment.AllDayEvent = calEntry.AllDay;
}
}
In the next post I hope to show you how to export your Outlook appointment to Groove.
Also Abbott who is the product manager for Groove pointed out that much of the helper code that I am writing in part of Groove Helpers. This is really cool, once I get down exploring the hard way I would like to go back and port my code to the Groove Helper.
If your at TechEd 2007 in Orlando next week, stop by the VSTO booth and talk to me about the code in detail.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· .NET周刊【3月第1期 2025-03-02】
· 分享 3 个 .NET 开源的文件压缩处理库,助力快速实现文件压缩解压功能!
· Ollama——大语言模型本地部署的极速利器
2004-07-20 郁闷的Xml Serialization BUG
2004-07-20 Python的异常处理