惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园_首页
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Proofpoint News Feed
G
Google Developers Blog
B
Blog
Engineering at Meta
Engineering at Meta
阮一峰的网络日志
阮一峰的网络日志
The Register - Security
The Register - Security
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 叶小钗
The Cloudflare Blog
The Hacker News
The Hacker News
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
CXSECURITY Database RSS Feed - CXSecurity.com
雷峰网
雷峰网
F
Fortinet All Blogs
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
H
Hackread – Cybersecurity News, Data Breaches, AI and More
酷 壳 – CoolShell
酷 壳 – CoolShell
Last Week in AI
Last Week in AI
T
Threat Research - Cisco Blogs
A
About on SuperTechFans
量子位
Recorded Future
Recorded Future
博客园 - 三生石上(FineUI控件)
H
Help Net Security
Help Net Security
Help Net Security
P
Palo Alto Networks Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
T
Troy Hunt's Blog
W
WeLiveSecurity
V
Vulnerabilities – Threatpost
T
The Exploit Database - CXSecurity.com
Know Your Adversary
Know Your Adversary
Apple Machine Learning Research
Apple Machine Learning Research
Scott Helme
Scott Helme
N
News | PayPal Newsroom
AWS News Blog
AWS News Blog
D
DataBreaches.Net
Blog — PlanetScale
Blog — PlanetScale
MongoDB | Blog
MongoDB | Blog
B
Blog RSS Feed
腾讯CDC
J
Java Code Geeks
Microsoft Azure Blog
Microsoft Azure Blog
TaoSecurity Blog
TaoSecurity Blog
GbyAI
GbyAI
Y
Y Combinator Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
D
Docker

博客园 - 港城大白鲨

SQLServer2022安装记录 Go 语言从入门到理解 Oracle日常问题集锦 IO流操作flush应用场景 java.lang.ClassNotFoundException: javax.servlet.http.HttpServlet 源码、反码、补码详解及Byte结构 SSL证书类型OV、EV、DV说明来源阿里云 Servlet导出Excel,Json content-type的理解和日常实践 .NET版本发布历史 C# 部分类 详解C#中 Thread,Task,Async/Await,IAsyncResult【转】 企业微信-自建应用使用审批流程引擎 C# 操作Excel 常用整理 SQLAlwayson搭建过程之三 AlwaysOn Failover Cluster Instance SQLAlwayson搭建过程之二 AlwaysOn可用性组 SQLAlwayson搭建过程之一故障转移集群WSFC Sharepoint server2019 通讯组(安全组)发送邮件问题 SQLServer链接服务器
C# 操作Exchange 的powershell以实现邮件撤回
港城大白鲨 · 2021-09-24 · via 博客园 - 港城大白鲨

参考地址

https://stackoverflow.com/questions/16099853/exchange-and-powershell
https://docs.microsoft.com/en-us/dotnet/api/microsoft.exchange.webservices.data.exchangeservice?view=exchange-ews-api

https://docs.microsoft.com/en-us/previous-versions/office/developer/exchange-server-2010/ff326159(v=exchg.140)

原理就是调用服务器上的Exchaange Management Shell

核心代码展示

string schemaUri = "http://schemas.microsoft.com/powershell/Microsoft.Exchange";
            string exPWD = ConfigurationManager.AppSettings["exPWD"].ToString();
            exPWD =Common.Utility.AESEncrypt.Decrypt(exPWD);
            string exUser = ConfigurationManager.AppSettings["exUser"].ToString();

            SecureString ser = ConvertToSecureString(exPWD);
            PSCredential credential_ = new PSCredential("centhome\\"+ exUser, ser);

            SearchMailModel smM = new SearchMailModel();
            smM.From = from;
            smM.Subject = subject;
            smM.Targetmail = targetmail;
            smM.received = received;

            Collection<PSObject> psResult = GetUsersUsingBasicAuth("https://mbx011.centhome.com/powershell", schemaUri,credential_, smM);