zoukankan      html  css  js  c++  java
  • C# 操作Exchange 的powershell以实现邮件撤回

    参考地址

    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);
  • 相关阅读:
    c#大圣之路笔记——c# 页面加载数据过长等待显示框
    Python(五)
    Python(四)
    Python(三)
    python(二)数据类型与变量
    初识Python
    Linux初识(九)
    Linux初识(八)正则表达式
    Linux基础初识(七)
    Linux基础初识(六)
  • 原文地址:https://www.cnblogs.com/life512/p/15330109.html
Copyright © 2011-2022 走看看