切换到宽版
Exchange 中文站
Exchange 2003
Exchange 2007
Exchange 2010
Exchange 2013
勋章中心
下拉
用户名
电子邮箱
用户名
密 码
记住登录
登录
找回密码
注册
快捷通道
关闭
您还没有登录,快捷通道只有在登录后才能使用。
立即登录
还没有帐号? 赶紧
注册一个
Exchange论坛
Exchange视频
Exchange技术论坛
>
Exchange 二次开发
>
Exchange Server 2007 二次开发 (六)
发帖
回复
返回列表
8215
阅读
1
回复
[分享]
Exchange Server 2007 二次开发 (六)
[复制链接]
上一主题
下一主题
tata
UID:10027
注册时间
2010-11-12
最后登录
2015-11-13
在线时间
866小时
发帖
363
搜Ta的帖子
精华
0
金币
186
访问TA的空间
加好友
用道具
初级工程师
关闭
个人中心可以申请新版勋章哦
立即申请
知道了
加关注
发消息
只看楼主
倒序阅读
0楼
发表于: 2011-02-19
关键词:
服务器
exchange
获得某账户的状态:
1
public
static
void
GetUserAvailability(ExchangeServiceBinding esb)
2
{
3
//
Identify the time to compare free/busy information.
4
Duration duration
=
new
Duration();
5
duration.StartTime
=
DateTime.Now;
6
duration.EndTime
=
DateTime.Now.AddHours(
4
);
7
8
//
Identify the options for comparing free/busy information.
9
FreeBusyViewOptionsType fbViewOptions
=
new
FreeBusyViewOptionsType();
10
fbViewOptions.TimeWindow
=
duration;
11
fbViewOptions.RequestedView
=
FreeBusyViewType.MergedOnly;
12
fbViewOptions.RequestedViewSpecified
=
true
;
13
fbViewOptions.MergedFreeBusyIntervalInMinutes
=
35
;
14
fbViewOptions.MergedFreeBusyIntervalInMinutesSpecified
=
true
;
15
16
MailboxData[] mailboxes
=
new
MailboxData[
1
];
17
mailboxes[
0
]
=
new
MailboxData();
18
19
//
Identify the user mailbox to review for free/busy data.
20
EmailAddress emailAddress
=
new
EmailAddress();
21
22
emailAddress.Address
=
"邮件地址
"
;
23
emailAddress.Name
=
String.Empty;
24
25
mailboxes[
0
].Email
=
emailAddress;
26
mailboxes[
0
].ExcludeConflicts
=
false
;
27
28
//
Make the request.
29
GetUserAvailabilityRequestType request
=
new
GetUserAvailabilityRequestType();
30
31
[img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img]
//
Set the time zone of the request.
32
[img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img]
request.TimeZone
=
new
SerializableTimeZone();
33
[img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img] request.TimeZone.Bias
=
480
;
34
[img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img] request.TimeZone.StandardTime
=
new
SerializableTimeZoneTime();
35
[img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img] request.TimeZone.StandardTime.Bias
=
0
;
36
[img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img] request.TimeZone.StandardTime.DayOfWeek
=
DayOfWeekType.Sunday.ToString();
37
[img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img] request.TimeZone.StandardTime.DayOrder
=
1
;
38
[img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img] request.TimeZone.StandardTime.Month
=
11
;
39
[img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img] request.TimeZone.StandardTime.Time
=
"
02:00:00
"
;
40
[img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img] request.TimeZone.DaylightTime
=
new
SerializableTimeZoneTime();
41
[img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img] request.TimeZone.DaylightTime.Bias
=
-
60
;
42
[img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img] request.TimeZone.DaylightTime.DayOfWeek
=
DayOfWeekType.Sunday.ToString();
43
[img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img] request.TimeZone.DaylightTime.DayOrder
=
2
;
44
[img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img] request.TimeZone.DaylightTime.Month
=
3
;
45
[img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img] request.TimeZone.DaylightTime.Time
=
"
02:00:00
"
;
46
[img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img]
47
[img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img]
//
Add the mailboxes to the request.
48
[img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img]
request.MailboxDataArray
=
mailboxes;
49
[img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img]
50
[img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img]
//
Add the view options to the request.
51
[img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img]
request.FreeBusyViewOptions
=
fbViewOptions;
52
[img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img]
53
[img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img]
try
54
[img]http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif[/img]
{
55
[img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img]
//
Send the request and get the response.
56
[img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img]
GetUserAvailabilityResponseType response
=
esb.GetUserAvailability(request);
57
[img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img]
58
[img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img]
//
Access free/busy information.
59
[img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img]
if
(response.FreeBusyResponseArray.Length
<
1
)
60
[img]http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif[/img]
{
61
[img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img]
throw
new
Exception(
"
No free/busy response data available.
"
);
62
[img]http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif[/img] }
63
[img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img]
else
64
[img]http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif[/img]
{
65
[img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img]
foreach
(FreeBusyResponseType fbrt
in
response.FreeBusyResponseArray)
66
[img]http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif[/img]
{
67
[img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img]
if
(fbrt.ResponseMessage.ResponseClass
==
ResponseClassType.Error)
68
[img]http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif[/img]
{
69
[img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img] Console.WriteLine(
string
.Format(
"
Error: {0}
"
, fbrt.ResponseMessage.MessageText));
70
[img]http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif[/img] }
71
[img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img]
else
72
[img]http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif[/img]
{
73
[img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img]
//
Show the free/busy stream.
74
[img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img]
FreeBusyView fbv
=
fbrt.FreeBusyView;
75
[img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img] Console.WriteLine(
string
.Format(
"
Merged free/busy data: {0}
"
, fbv.MergedFreeBusy));
76
[img]http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif[/img] }
77
[img]http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif[/img] }
78
[img]http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif[/img] }
79
[img]http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif[/img] }
80
[img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img]
catch
(Exception e)
81
[img]http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif[/img]
{
82
[img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img]
//
Perform error processing.
83
[img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img]
Console.WriteLine(e.Message);
84
[img]http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif[/img] Console.ReadLine();
85
[img]http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif[/img] }
86
[img]http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif[/img] }
共
条评分
回复
举报
分享到
script
UID:11734
注册时间
2011-03-09
最后登录
2015-02-02
在线时间
37小时
发帖
89
搜Ta的帖子
精华
0
金币
170
访问TA的空间
加好友
用道具
技术人员
加关注
发消息
只看该作者
1楼
发表于: 2011-03-09
二次开发是充分利用Exchange的最好办法。
共
条评分
回复
举报
发帖
回复
返回列表
http://bbs.exchangecn.com
访问内容超出本站范围,不能确定是否安全
继续访问
取消访问
快速回复
限60 字节
您目前还是游客,请
登录
或
注册
进入高级模式
文字颜色
发 布
回复后跳转到最后一页
上一个
下一个
关闭
补充发布信息
验证码:
验证问题:
65 + 29 = ?
发 布
隐藏
快速跳转
Microsoft 企业云服务
Office 365 定制版用户讨论区
Exchange 技术讨论
Exchange Server 2016
Exchange Server 2013
Exchange Server 2010
Exchange Server 2007
Exchange Server 2003
Exchange 相关技术
Exchange 事件日志
Exchange 二次开发
Microsoft Outlook
Exchange 资源下载
Exchange 2003 资源下载
Exchange 2007 资源下载
Exchange 2010 资源下载
Exchange 招聘求职
Exchange 招聘 | 求职
Exchange 社区站务
站内站务
关闭
关闭
选中
1
篇
全选