• 當前位置:首頁 > IT技術 > Windows編程 > 正文

    C# 操作Exchange 的powershell以實現郵件撤回
    2021-09-24 14:47:37

    參考地址

    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);

    ?

    本文摘自 :https://www.cnblogs.com/

    開通會員,享受整站包年服務
    国产呦精品一区二区三区网站|久久www免费人咸|精品无码人妻一区二区|久99久热只有精品国产15|中文字幕亚洲无线码