1.准备 Microsoft.Exchange.WebServices.dll 和 Microsoft.Exchange.WebServices.Auth.dll
2.调用对应方法
class Program
static void Main(string[] args)
// Validate the server certificate.
// For a certificate validation code example, see the Validating X509 Certificates topic in the Core Tasks section.
// Connect to Exchange Web Services as user1 at contoso.com.
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2013_SP1);
service.Credentials = new WebCredentials("邮箱@outlook.com", "密码,");
service.AutodiscoverUrl("han.l@outlook.com");
// Create the e-mail message, set its properties, and send it to user2@contoso.com, saving a copy to the Sent Items folder.
EmailMessage message = new EmailMessage(service);
message.Subject = "Interesting";
message.Body = "The proposition has been considered.";
message.ToRecipients.Add("发送的邮件");
//发送邮件
message.Send();
Console.WriteLine("Message sent!");
Console.ReadLine();
Appointment appointment = new Appointment(service);
appointment.Subject = "Status Meeting";
appointment.Body = "The purpose of this meeting is to discuss status.";
appointment.Start = new DateTime(2017, 12, 27, 16, 0, 0); //年月日 时分秒
appointment.End = appointment.Start.AddHours(2);
appointment.Location = "Conf Room";
appointment.RequiredAttendees.Add("发送的邮件1");
appointment.RequiredAttendees.Add("发送的邮件2");
//订会议
appointment.Save(SendInvitationsMode.SendOnlyToAll);
// 查询对应日程
DateTime startDate = DateTime.Now.AddDays(-1);
DateTime endDate = startDate.AddDays(30);
const int NUM_APPTS = 5;
// Initialize the calendar folder object with only the folder ID.
CalendarFolder calendar = CalendarFolder.Bind(service, WellKnownFolderName.Calendar, new PropertySet());
// Set the start and end time and number of appointments to retrieve.
CalendarView cView = new CalendarView(startDate, endDate, NUM_APPTS);
// Limit the properties returned to the appointment's subject, start time, and end time.
cView.PropertySet = new PropertySet(AppointmentSchema.Subject, AppointmentSchema.Start, AppointmentSchema.End);
// Retrieve a collection of appointments by using the calendar view.
FindItemsResults<Appointment> appointments = calendar.FindAppointments(cView);
Console.WriteLine("\nThe first " + NUM_APPTS + " appointments on your calendar from " + startDate.Date.ToShortDateString() +
" to " + endDate.Date.ToShortDateString() + " are: \n");
foreach (Appointment a in appointments)
//显示当前有的日程
Console.Write("Subject: " + a.Subject.ToString() + " ");
Console.Write("Start: " + a.Start.ToString() + " ");
Console.Write("End: " + a.End.ToString());
Console.WriteLine();
//拿到用户消息
AutodiscoverService autodiscoverService = new AutodiscoverService("outlook.office365.com");
autodiscoverService.Credentials = new NetworkCredential("han.wang@xunyisoft.com", "liange0819jia,", "outlook.office365.com");
//提交请求并获取设置。响应只包含所请求的
//设置,如果它们存在的话。
GetUserSettingsResponse userresponse = autodiscoverService.GetUserSettings(
"z@xunyisoft.com",
UserSettingName.UserDN,
UserSettingName.UserMSOnline, //是否在线
UserSettingName.UserDisplayName, //显示名称
UserSettingName.InternalEcpVoicemailUrl,
UserSettingName.InternalEcpEmailSubscriptionsUrl,
UserSettingName.EcpVoicemailUrlFragment,
UserSettingName.EcpEmailSubscriptionsUrlFragment,
UserSettingName.ExternalEcpVoicemailUrl,
UserSettingName.ExternalEcpEmailSubscriptionsUrl,
UserSettingName.AlternateMailboxes,
UserSettingName.ActiveDirectoryServer,
UserSettingName.UserDeploymentId,
UserSettingName.InternalMailboxServer,
UserSettingName.MailboxDN,
UserSettingName.PublicFolderServer,
UserSettingName.ActiveDirectoryServer,
UserSettingName.ExternalMailboxServer,
UserSettingName.EcpDeliveryReportUrlFragment,
UserSettingName.EcpPublishingUrlFragment,
UserSettingName.EcpTextMessagingUrlFragment,
UserSettingName.ExternalEwsUrl,
UserSettingName.CasVersion,
UserSettingName.EwsSupportedSchemas
Console.WriteLine(userresponse);
foreach (KeyValuePair<UserSettingName, Object> usersetting in userresponse.Settings)
Console.WriteLine(usersetting.Key.ToString() + ": " + usersetting.Value);
// Get the number of items in the contacts folder. To limit the size of the response, request only the TotalCount property.
ContactsFolder contactsfolder = ContactsFolder.Bind(service,
WellKnownFolderName.Contacts,
new PropertySet(BasePropertySet.FirstClassProperties, FolderSchema.TotalCount));
// Set the number of items to the number of items in the Contacts folder or 50, whichever is smaller.
int numItems = contactsfolder.TotalCount < 50 ? contactsfolder.TotalCount : 50;
// Instantiate the item view with the number of items to retrieve from the Contacts folder.
ItemView view = new ItemView(numItems);
// To keep the response smaller, request only the display name.
view.PropertySet = new PropertySet(BasePropertySet.FirstClassProperties, ContactSchema.DisplayName,
ContactSchema.Birthday,
ContactSchema.JobTitle,
ContactSchema.Alias,
ContactSchema.AssistantName,
//ContactSchema.EmailAddresses,
//ContactSchema.PhoneNumbers,
ContactSchema.ManagerMailbox); //EmailAddresses PhoneNumbers 不能在这里加入请求
// Request the items in the Contacts folder that have the properties that you selected.
FindItemsResults<Item> contactItems = service.FindItems(WellKnownFolderName.Contacts, view);
foreach (Item item in contactItems)
if (item is Contact)
Contact contact = item as Contact;
Console.WriteLine(contact.DisplayName);
// Console.WriteLine(contact.PhoneNumbers);
Console.WriteLine(contact.JobTitle);
Console.WriteLine(contact.Alias);
Console.WriteLine(contact.AssistantName);
Console.WriteLine(contact.ManagerMailbox);
NameResolutionCollection nd = service.ResolveName(contact.EmailAddresses[EmailAddressKey.EmailAddress1].Address);
// foreach (NameResolution nm in nd)
// if (nm.Mailbox.RoutingType =="SMTP")
// {
// Console.WriteLine ( nm.Mailbox.Address);
// }
// }
// Console.ReadLine();
// // Console.WriteLine(contact.AssistantName);
Console.WriteLine(contactItems);
Console.ReadLine();
catch (Exception ex)
Console.WriteLine("Error: " + ex.Message);
Console.ReadLine();
1.准备 Microsoft.Exchange.WebServices.dll 和 Microsoft.Exchange.WebServices.Auth.dll2.调用对应方法 class Program { static void Main(string[] args) { // Validate the server certi...
最近公司要求和exchange服务对接,所以稍微研究了一下官方文档,做出以下总结,欢迎大家补充。
先放出exchange官方开发说明文档:https://docs.microsoft.com/zh-cn/exchange/client-developer/exchange-web-services/calendars-and-ews-in-exchange
与exchange web服务器建立连...
using System;using System.Net;using System.Collections.Generic;using EWS;using MailClient;
namespace ExchangeWs { public class ExchangeWs { private ExchangeServiceBinding esb = null; ...
微软基于exchange服务器提供的web service所开发的API,
用于C#定制基于exchange的相关应用,
安装包内会安装32/64bit两个安装包,
使用时请根据操作手册复制相应的dll到特定项目
最近项目中需要用到exchange的操作,就参照msdn弄了一个简单的操作类。目前先实现了,发送邮件和拉取收件箱的功能,其他的以后在慢慢的添加。
using Microsoft.Exchange.WebServices.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using Syst...
是一个国际联盟,旨在共享基因组和临床数据。
可帮助基因组学和健康社区充分利用现代云环境。 我们最初的重点是通过创建用于定义,共享和执行可移植工作流的标准来“将算法引入数据”。
我们与平台开发合作伙伴和行业领导者合作,以开发有助于互操作性的标准。
什么是WES?
工作流执行服务API描述了一种运行和管理工作流的标准编程方式。 具有多个执行引擎支持的该标准API,将使人们能够使用在各种云/环境上运行的各种执行平台来运行相同的工作流。 主要功能包括:
请求使用CWL或WDL运行工作流的能力
使用JSON模式参数化该工作流程的能力
获得有关正在运行的工作流程的信息的能力
API定义
请参阅易于阅读的和。 您也可以在浏览规范。
ga4gh.github.io/workflow-execution-service上
这篇博客的目的:根据亲身项目经历,总结对AD及Exchange Server的操作,包括新建AD用户,设置密码,为AD用户创建邮箱等。
本文完全原创,转载请说明出处,希望对大家有用。
文档目录:
测试环境及需求简述
对AD操作
引入DLL及方法简述
新增OU或Security Group
新建AD User
添加用户到组或从组中删除用户
用户信息更新
Enable/Di...
上一节C#操作AD及Exchange Server总结(一)写了对AD的操作,新建AD用户后,通常都需要为此用户开启Exchange邮箱,接下来写如何远程操作Exchange。
三、对Exchange Server操作
操作exchange会用到新的DLL,需要安装Windows power shell,安装后在路径:C:\Program Files (x86)\Reference Assem...