zoukankan      html  css  js  c++  java
  • 云端转发邮箱

    云端转发邮箱,即office365方式转发,特别注意连接方法和脚本

                RunspaceConfiguration runspaceConfiguration = RunspaceConfiguration.Create();
                Runspace runspace1 = RunspaceFactory.CreateRunspace(runspaceConfiguration);
                try
                {
                  
                    runspace1.Open();
            
                    ParameterObjectCloud paramObject = new ParameterObjectCloud() { powerUser = "admin@onmicrosoft.com"};
                    runspace1.SessionStateProxy.SetVariable("arg", paramObject);
    
                    Pipeline pipeline = runspace1.CreatePipeline();
                    Command command = null;
    
                    command = new Command("$powerPass = '密码'", true);
                    pipeline.Commands.Add(command);
                    command = new Command("$arg.Password = ConvertTo-SecureString $powerPass -AsPlainText -Force", true);
                    pipeline.Commands.Add(command);
                    command = new Command("$arg.Credential = New-Object -TypeName System.Management.Automation.PSCredential($arg.powerUser,$arg.Password)", true);
                    pipeline.Commands.Add(command);
                    command = new Command("$s =New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri 'https://ps.outlook.com/powershell' -Credential $arg.Credential -Authentication Basic -AllowRedirection", true);
                    pipeline.Commands.Add(command);
                    command = new Command("Import-PSSession $s", true);
                    pipeline.Commands.Add(command);
                    command = new Command("Set-Mailbox -Identity '"+adUser.UserPrincipalName+"' -DeliverToMailboxAndForward $true -ForwardingSMTPAddress '"+adUser.ForwardingOneMailbox+"'", true);
                    pipeline.Commands.Add(command);
                    var results = pipeline.Invoke();
                    result.ExecResult = ExecResult.Success;
                    runspace1.Dispose();
                    return result;
  • 相关阅读:
    Displaying Tabbed and Stacked Canvas Using Show_View In Oracle Forms
    Sort Detail Data Block Example
    Oracle Forms Execute_Query Example To Fetch The Records From Database
    web交互方式
    Ajax、Comet与Websocket
    Websocket和PHP Socket编程
    websocket webworker
    Android消息推送
    游戏服务器
    Comet:基于 HTTP 长连接的“服务器推”技术
  • 原文地址:https://www.cnblogs.com/shiningleo007/p/6743621.html
Copyright © 2011-2022 走看看