Tag: exchangewebservices

尝试使用EWS MANAGED API访问Exchange 2010帐户时,无法找到“自动发现服务”

我正在使用自动发现服务Url来获取指定的电子邮件地址。 ExchangeService Service = new ExchangeService(ExchangeVersion.Exchange2010); Service.Credentials = new WebCredentials(“username@domainname.com”, “Password”); Service.AutodiscoverUrl(“username@domainname.com”); Folder inbox = Folder.Bind(Service, WellKnownFolderName.Inbox); Console.WriteLine(“The folder name is” + inbox.DisplayName.ToString()); 如果我喜欢这个,我会得到一个错误: 无法找到自动发现服务 我该怎么做才能避免这个错误?

如何使用EWS获取电子邮件正文,收据,发件人和CC信息?

谁能告诉我如何使用Exchange Web服务API获取电子邮件正文,收据,发件人,CC信息? 我只知道如何获得主题。 ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010); service.Credentials = new NetworkCredential(“user”, “password”, “domain”); service.Url = new Uri(“https://208.243.49.20/ews/exchange.asmx”); ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true; FindItemsResults findResults = service.FindItems( WellKnownFolderName.Inbox, new ItemView(10)); foreach (Item item in findResults.Items) { div_email.InnerHtml += item.Subject+””; } 我的开发环境是asp.net c#Exchange-server 2010谢谢。

PR_SEARCH_KEY使用EWS

我需要使用EWS为某些邮件提取PR_SEARCH_KEY 。 我之前使用的是Outlook API。 但我想在EWS中重写完整的代码,因为它function强大。 旧代码: private String GetLnksForMailBoxMails(Outlook.MailItem mail) { const string PR_SEARCH_KEY = “http://schemas.microsoft.com/mapi/proptag/0x300B0102”; Outlook.PropertyAccessor pa = mail.PropertyAccessor; String searchKey = pa.BinaryToString(pa.GetProperty(PR_SEARCH_KEY)); // Console.WriteLine(“Here is lnks for normal mail box:{0} “, searchKey); return searchKey; } 新代码: ExtendedPropertyDefinition eDef = new ExtendedPropertyDefinition(0x300B, MapiPropertyType.Binary); PropertySet prop = BasePropertySet.IdOnly; prop.Add(eDef); ItemView ivItemView = new ItemView(5000); ivItemView.PropertySet […]

Exchange Web服务 – 将电子邮件附件从Base64字符串转换为字节提供错误

我正在尝试使用EWS读取电子邮件附件,并将其作为文本文件保存到磁盘,以便以后使用。 我收到一个错误: “The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or a non-white space character among the padding characters. ” 这是我的代码: Directory.CreateDirectory(emailAttachmentsPath); // Put attachment contents into a stream. C:\Dev\EWSHelloWorld emailAttachmentsPath = emailAttachmentsPath + “\\” + sEmailSubject+”.txt”; //save to disk using (Stream FileToDisk […]

EWS托管API – 使用Html Body和Outlook 2013进行预约

我正在尝试使用包含超链接的Html Body创建一个约会,就像在此示例中所示: ewsAppointment = new EwsData.Appointment(service); ewsAppointment.Subject = “Test”; var element = new XElement(“html”, new XElement(“body”, new XElement(“p”, new XElement(“a”, new XAttribute(“href”, “http://www.google.it/”), “google”)), new XElement(“p”, “test 2”)))); ewsAppointment.Body.BodyType = EwsData.BodyType.HTML; ewsAppointment.Body = element.ToString(); ewsAppointment.Save(SendInvitationsMode.SendToNone); 当我在Outlook 2010中打开此约会时,Body看起来像预期的那样: 但在Outlook 2013中,Body的格式丢失了,它看起来像这样: 知道如何解决这个问题吗?

在外发电子邮件EWS中设置回复地址

运行Exchange 2013 我在ac#服务中使用EWS,它从服务帐户发送电子邮件。 我希望电子邮件的回复地址与发送帐户不同,即分发列表地址。 我怎样才能做到这一点? EmailMessage.ReplyTo字段是只读的。 码: ExchangeService service = new ExchangeService(); service.Credentials = EWScredentials; service.Url = new Uri(string.Format(“https://{0}/EWS/Exchange.asmx”, ExchangePath)); EmailMessage message = new EmailMessage(service); message.ToRecipients.AddRange(receipients); //This didn’t work message.ReplyTo.Clear(); message.ReplyTo.Add(replyToAddress); message.Subject = subject; message.Body = html; message.SendAndSaveCopy(); 只有其他似乎相关的线程,虽然我没有使用PowerShell: 如何使用EWS托管API设置消息回复地址?

服务帐户中的Exchange模拟:无法找到自动发现服务

通过ews发送简单的电子邮件正在按预期工作 – 从我的帐户到我的帐户: ExchangeService ews = new ExchangeService(ExchangeVersion.Exchange2010); ews.AutodiscoverUrl(“myname@mydomain.com”); EmailMessage email = new EmailMessage(ews); email.ToRecipients.Add(“myname@mydomain.com”); email.Subject = “HelloWorld”; email.Body = new MessageBody(“This is the first email I’ve sent by using the EWS Managed API”); email.Send(); 简单地尝试模拟,它也按预期工作 – 在最后一行,它返回我不允许冒充的错误: ExchangeService ews = new ExchangeService(ExchangeVersion.Exchange2010); ews.AutodiscoverUrl(“myname@mydomain.com”); ews.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.SmtpAddress, “testuser@mydomain.com”); EmailMessage email = new EmailMessage(ews); email.ToRecipients.Add(“myname@mydomain.com”); […]

使用Exchange Web服务从Exchange下载附件

我试图使用以下代码使用C#和Exchange Web服务从收件箱中的电子邮件连接和下载附件,但我收到’System.ArgumentOutOfRangeException’错误,我不明白为什么。 我已经google了一个答案,但我找不到一个或我找到的答案是非常旧版本的EWS。 我知道其余代码通常有效,因为我可以访问与电子邮件相关的其他信息,只是不访问附件。 有人向我展示了我的方式错误吗? 提前致谢, 詹姆士 static void Main(string[] args) { ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1); service.Credentials = new NetworkCredential(“MYLOGIN”, “MYPASSWORD”, “MYDOMAIN”); service.Url = new Uri(“https://MYMAILSERVER/EWS/Exchange.asmx”); ServicePointManager.ServerCertificateValidationCallback = delegate { return true; }; FindItemsResults findResults = service.FindItems(WellKnownFolderName.Inbox, new ItemView(1000)); foreach (Item item in findResults.Items) { if (item.HasAttachments && item.Attachments[0] is FileAttachment) { FileAttachment fileAttachment […]

使用EWS Exchange创建电子邮件并附加其他电子邮件

我在使用EWS将电子邮件附加到新电子邮件时遇到问题。 所以我的findResults中有Microsoft.Exchnage.Webservice.Data.Item。 如果我在电子邮件的表单数据中发现问题,那么我想将该项目附加到新电子邮件中并将其发送给主管进行手动输入。 我试过了; EmailMessage newMessage = new EmailMessage(exchange); newMessage.Subject = “Failed lead creation”; ItemAttachment attachment = new ItemAttachment(“New Lead”, message); 我似乎无法创建ItemAttachment,因为我得到的错误是“ItemAttachment不包含带有2个参数的构造函数”。 如何在EWS中创建新邮件,将当前项目附加到其中并发送给其他收件人? Thaks

使用Exchange Web服务在网页上显示Exhange / Outlook会议室日历的最简单方法是什么?

使用Exchange Web服务在网页上显示Exhange / Outlook会议室日历的最简单方法是什么? 没有必要能够预订房间,取消会议等,只能在接下来的5天内在某个会议室中显示会议。 根据我的研究,我认为这些可能是我需要使用的,我只是不确定如何在网页中使用这些代码示例: http://msdn.microsoft.com/en-us/library/office/dn439786%28v=exchg.80%29.aspx 或这个: 从Exchange有效地获得房间预约 您的回答,指导将不胜感激! 谢谢!