使用VSTO把Groove和Outlook的约会进行同步(转)
2007-07-20 11:52
351 查看
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.
相关文章推荐
- 在 Ubuntu 中使用 NTP 进行时间同步设置
- Windows Phone 7中配置gmail, 使用outlook 同步邮件,日历,联系人等
- K近邻改进约会网站(五):使用算法进行预测
- 使用 C# 进行 Outlook 2007 编程
- [生产库实战] 如何使用触发器对生产库上亿级大表进行实时同步
- 进程间通信(IPC)4 ------ 共享内存(配合使用信号量进行同步)
- 使用rdate进行时间同步
- 使用rsync进行同步
- 使用信号进行同步 sem_post
- 使用postgreSQL DataSync 进行pg数据库升级 数据同步 升级脚本生成, postgreSQL DataSync简单教程
- 使用postgreSQL DataSync 进行pg数据库升级 数据同步 升级脚本生成, postgreSQL DataSync简单教程
- 细说.NET中的多线程 (四 使用锁进行同步)
- 使用Winscp进行Linux到Windows的文件同步
- Linux下使用ntpdate进行时间同步
- 【Android Training - 15】云同步的实现 [Lesson 1 - 使用App Engine进行同步]
- 使用VS2008进行VSTO-Addin实战开发-创建自己的菜单(一)
- 使用VS2008进行VSTO-Addin实战开发-创建自己的工具栏(二)
- Android解决activity、service间使用sharePreference进行值存取不同步
- 教你使用Outlook轻松同步iPhone电话簿