博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
How to configure your MyInbox webpart automatically ?
阅读量:6946 次
发布时间:2019-06-27

本文共 2352 字,大约阅读时间需要 7 分钟。

 

It seems to be so difficult to configure your SharePoint Outlook webparts automatically, but it isn't !

Last week, I tried everything, but I failed to configure those Outlook webparts.
It seems to be nobody wants to configure a MyInbox automatically for every user on the MySite. I didn't found any website or blog with information, I just found some questions on forums without an answer.
So, Can I conclude that every user must know the servername and his mailboxname ?
No, it's irrealistic in my opinion !
This morning, I had 'one of my famous intelligent moments' *d'oh*
So, here's the one and only, the solution !
Follow the autoConfig lab below to succeed the configuration for every user at runtime
1. Create a new Webpart Library project
2. Override the CreateChildControls
// import section
using Microsoft.SharePoint.Portal.WebControls;
// attributes
private OWAInboxPart wpInbox;
protected override void CreateChildControls()
{
// inbox webpart
wpInbox = new OWAInboxPart();
Controls.Add(configureInbox(wpInbox));
}
3. Create a new method to configure your Inbox webpart. This method will determine the mailboxname and the servername at runtime for a particular user.
private OWAInboxPart configureInbox(OWAInboxPart wpInbox)
{
//Connect to the portal and get the portal context.
TopologyManager topology = new TopologyManager();
PortalSite portal = topology.PortalSites[new Uri(
)];
PortalContext context = PortalApplication.GetContext(portal);
//initialize user profile config manager object
UserProfileManager profileManager = new UserProfileManager(context);
UserProfile prof = profileManager.GetUserProfile(true);
// use the profile object to retrieve the properties you need in your company to
// retrieve the mailboxname
// example: string workmail = prof[PropertyConstants.WorkEmail].ToString();
wpInbox.MailboxName = "kristofdc";
wpInbox.OWAServerAddressRoot = "";
return wpInbox;
}
4. Override the RenderWebPart method
protected override void RenderWebPart(HtmlTextWriter output)
{
try
{
wpInbox.RenderControl(output);
}
catch(Exception ex)
{
output.Write(ex.ToString());
}
}
5. And finally you will add a CAB-setup for your custom webpart.
6. Just compile, deploy and use !
Remarks:
This MyInbox example works also with the MyCalendar & MyTasks.
Success garanteed !

转载于:https://www.cnblogs.com/ahghy/archive/2012/12/25/2831918.html

你可能感兴趣的文章
『算法学习』Mask-R-CNN
查看>>
wepy - Cannot read property 'Promise' of undefined
查看>>
oracle 拼接字符串的两种方式
查看>>
Base PyQt4, Simple Web APP Framwork
查看>>
如何设计定向爬虫
查看>>
初识toolstack——XEN的XenServer管理的核心
查看>>
20篇教你得到酷炫效果的JQuery教程
查看>>
安装程序找不到Office.zh-cn\OfficeMUI问题
查看>>
如何使用VIM的列编辑模式 [转]
查看>>
System.Collections简介
查看>>
POJ-3211 Washing Clothes[01背包问题]
查看>>
Android--MediaPlayer(实现列表选歌,上一首,下一首,清空播放列表,搜索本地音乐文件)...
查看>>
ODE的buggy例程分析
查看>>
判断文章/帖子操作权限
查看>>
计算机英文缩写
查看>>
Windows2003 SQL2005解决系统Administrator密码不知道的问题
查看>>
curl常用的5个例子(转)
查看>>
wCF 问题收集页
查看>>
《ASP.NET MVC4 WEB编程》学习笔记------.net mvc实现原理ActionResult/View
查看>>
1、传感器概述
查看>>