对Exchange Web服务使用DefaultCredentials [英] UseDefaultCredentials with Exchange Web Services

查看:153
本文介绍了对Exchange Web服务使用DefaultCredentials的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个非常新的程序员.我工作中要做的一件事情就是获得我们的自定义工具,以创建电子邮件草稿并将其拖放到运行该工具的用户的电子邮件草稿文件夹中.我们目前使用的是Exchange Server 2010(但正在迁移到Exchange Online).

I'm a pretty new programmer. One of the things I've been tasked with at work is getting our custom tools to create draft emails and drop them into the draft email folder of the user running the tool. We presently use Exchange Server 2010 (but are in the process of migrating over to Exchange Online).

This link talks about a UseDefaultCredentials but I can't seem to work out how to implement it. I created an ExchangeService object called service and managed to interact with our Exchange server using this for credentials:

service.Credentials = new WebCredentials(我的登录名",我的密码");

service.Credentials = new WebCredentials("my login name", "my password");

我希望能够从代码中消除它,并使其使用正在使用该工具的登录用户的凭据.有可能吗?

I'd like to be able to eliminate that from the code and have it use the credentials of the logged-in user who is using the tool. Is that possible?

推荐答案

ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010);
service.Credentials = new WebCredentials(CredentialCache.DefaultNetworkCredentials);

这篇关于对Exchange Web服务使用DefaultCredentials的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆