您的位置:首页 > 其它

[SharePoint 2010]开发与SharePoint2010 数据同步的Outlook2007 add-in

2010-09-19 15:47 330 查看
  随着VS2010和SharePoint2010的推出,微软对与office产品线的协同工作开发的支持越来越强大了,开发一些office产品的插件也变得方便了很多,这里介绍一下啊Outlook2007 add-in的开发,使得能够和SharePoint2010完成同步。

  企业在使用SharePoint的同时,有时候可以和Outlook集成起来,比如在SharePoint中创建了一个Training meeting,但是在SharePoint中无法象Outlook那样Book meeting room,添加Attendee也不如Outlook里来的方便,因此希望同时能够在Outlook中也创建meeting request,这样不仅可以完成以上功能,同样也可以使用Outlook的TO-DO list的功能,管理个人的Calendar,同时和meeting有关的信息又可以在SharePoint site上管理维护。要完成这样的功能,我们首先需要开发一个Outlook add-in。下面介绍详细步骤:

1.打开visual studio 2010 (2008亦可)->New Project, 在office栏中选择Outlook 2007 Add-in 模板,创建完项目后,Add New Item, 选择Ribbon(Visual Designer)此item.

2.双击刚才创建的Ribbon item,可以看见一个Ribbon的设计视图,根据需要修改Tab,Group的名字,并在旁边的toolbox中拖一个button到group中。修改button的name,根据自己需要设置一些UI,这样UI部分就完成了,如下图:

代码

function OpenOutlookMeetingRequest(strTo, strCC, strSubject, strHTMLBody, strStart, strEnd, strLocation)
{
var outlookApp = new ActiveXObject("Outlook.Application");
try
{
var mailItem= outlookApp.createItem(1); //Appointment
mailItem.MeetingStatus = 1;//Set Appointment to Meeting
mailItem.Subject=strSubject;
mailItem.Body = strHTMLBody;
mailItem.Start = strStart;
mailItem.End = strEnd;
mailItem.Location = strLocation;
if(strTo != "")
mailItem.recipients.add(strTo);
mailItem.display (0);
}
finally
{
outlookApp =null;
}
}

这样,当我们在SharePoint的Training Meeting List中创建一个Meeting item结束的时候,都会弹出一个Outlook meeting request的窗口,我们把当前在Item中添加的一些相关信息,如Topic,Agenda等等先自动填入meeting request窗口的Subject和Body中,一旦我们在meeting request的窗口中完成了Room booking和Agendee的添加后,我们可以点击Ribbon tab中的同步按钮,完成信息写回到SharePoint的过程。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐