WEB开发网
开发学院服务器其它服务 Exchange 2007 新特性与二次开发 阅读

Exchange 2007 新特性与二次开发

 2007-11-15 00:00:00 来源:WEB开发网   
核心提示: CreateItemResponseType createItemResponse = esb.CreateItem(createEmailRequest); 接下来我们就以为用户创建邮件信息应用为例,向大家全面地展示一下如何利用Exchange Web Service进行二次开

CreateItemResponseType createItemResponse = esb.CreateItem(createEmailRequest);

 接下来我们就以为用户创建邮件信息应用为例,向大家全面地展示一下如何利用Exchange Web Service进行二次开发。

private void SendMail(ExchangeServiceBinding esb)
{
//创建 CreateItem 的请求
CreateItemType createEmailRequest = new CreateItemType();
//确定 Mail的处理方式
createEmailRequest.MessageDisposition = MessageDispositionType.SendAndSaveCopy;
createEmailRequest.MessageDispositionSpecified = true;
//确定发送信息存放的位置
createEmailRequest.SavedItemFolderId = new TargetFolderIdType();
DistinguishedFolderIdType sentitmes = new DistinguishedFolderIdType();
sentitmes.Id = DistinguishedFolderIdNameType.sentitems;
createEmailRequest.SavedItemFolderId.Item = sentitmes;
//创建存放数组
createEmailRequest.Items = new NonEmptyArrayOfAllItemsType();
//创建 e-mail 信息
MessageType message = new MessageType();
message.Subject = "Mail Test";
message.Body = new BodyType();
message.Body.BodyType1 = BodyTypeType.Text;
message.Body.Value = "TOoo Busy!!!!.";
message.Sender = new SingleRecipientType();
message.Sender.Item = new EmailAddressType();
message.Sender.Item.EmailAddress = "Administrator@DFQVPI-dom.extest.microsoft.com";
message.ToRecipients = new EmailAddressType[1];
message.ToRecipients[0] = new EmailAddressType();
message.ToRecipients[0].EmailAddress = Receiver;
message.Sensitivity = SensitivityChoicesType.Normal;
createEmailRequest.Items.Items = new ItemType[1];
createEmailRequest.Items.Items[0] = message;
try
{
// 创建绑定
ExchangeServiceBinding esb = new ExchangeServiceBinding();
esb.Credentials = new NetworkCredential("administrator", "J$p1ter", " DFQVPI-dom");
esb.Url = "https://bjextest043/EWS/exchange.asmx";
//发送CreateItem的请求
CreateItemResponseType createItemResponse = esb.CreateItem(createEmailRequest);
ArrayOfResponseMessagesType responseMessages = createItemResponse.ResponseMessages;
}
catch (Exception ex)
{
throw new Exception("Warning: " + ex.Message);
}
}

Exchange Web Service是一个新的开发技术,在未来的日子它会得到更效地发展和完善,如果大家有兴趣的话可以尽早投入到这项新技术中,经过自己的实践与思考,定会成为这项新技术的专家。

上一页  1 2 3 4 5 

Tags:Exchange 特性 二次

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接