none
How do you mail-enable a public folder in exchange 2013 with managed api 2.0 RRS feed

Answers

  • That method won't work anymore (it was something that came originally from Exchange 2000 and WebDAV). Because of the changes in the way Public Folders are delivered in Exchange 2013 there is no way of mail enabling a folder via EWS. What you should use is the Exchange Management Shell Enable-MailPublicFolder cmdlet eg you can do this in c#

                string PSServerName = "ps.outlook.com/PowerShell-LiveID?PSVersion=2.0";
                String AdminUserName = "user@blah.onmicrosoft.com";
                String Password = "pass";
    
                System.Security.SecureString secureString = new System.Security.SecureString();
                foreach (char c in Password)
                    secureString.AppendChar(c);
                PSCredential credential = new PSCredential(AdminUserName, secureString);
                WSManConnectionInfo connectionInfo = new WSManConnectionInfo(new Uri("https://" + PSServerName), "http://schemas.microsoft.com/powershell/Microsoft.Exchange", credential);
                connectionInfo.AuthenticationMechanism = AuthenticationMechanism.Basic;
                connectionInfo.SkipCACheck = true;
                connectionInfo.SkipCNCheck = true;
    
                connectionInfo.MaximumConnectionRedirectionCount = 4;
                Runspace runspace = System.Management.Automation.Runspaces.RunspaceFactory.CreateRunspace(connectionInfo);
                runspace.Open();
                Command menbFolder = new Command("Enable-MailPublicFolder");
                menbFolder.Parameters.Add("Identity", "\\aaaa\\bbbb");
                Pipeline plPileLine = runspace.CreatePipeline();
                plPileLine.Commands.Add(menbFolder);
                Collection<PSObject> RsResultsresults = plPileLine.Invoke();
                plPileLine.Stop();
                runspace.Close();
                runspace.Dispose();
    Cheers
    Glen
    • Marked as answer by GeorgiIvanov Thursday, August 22, 2013 6:34 AM
    Tuesday, August 20, 2013 2:56 AM

All replies

  • That method won't work anymore (it was something that came originally from Exchange 2000 and WebDAV). Because of the changes in the way Public Folders are delivered in Exchange 2013 there is no way of mail enabling a folder via EWS. What you should use is the Exchange Management Shell Enable-MailPublicFolder cmdlet eg you can do this in c#

                string PSServerName = "ps.outlook.com/PowerShell-LiveID?PSVersion=2.0";
                String AdminUserName = "user@blah.onmicrosoft.com";
                String Password = "pass";
    
                System.Security.SecureString secureString = new System.Security.SecureString();
                foreach (char c in Password)
                    secureString.AppendChar(c);
                PSCredential credential = new PSCredential(AdminUserName, secureString);
                WSManConnectionInfo connectionInfo = new WSManConnectionInfo(new Uri("https://" + PSServerName), "http://schemas.microsoft.com/powershell/Microsoft.Exchange", credential);
                connectionInfo.AuthenticationMechanism = AuthenticationMechanism.Basic;
                connectionInfo.SkipCACheck = true;
                connectionInfo.SkipCNCheck = true;
    
                connectionInfo.MaximumConnectionRedirectionCount = 4;
                Runspace runspace = System.Management.Automation.Runspaces.RunspaceFactory.CreateRunspace(connectionInfo);
                runspace.Open();
                Command menbFolder = new Command("Enable-MailPublicFolder");
                menbFolder.Parameters.Add("Identity", "\\aaaa\\bbbb");
                Pipeline plPileLine = runspace.CreatePipeline();
                plPileLine.Commands.Add(menbFolder);
                Collection<PSObject> RsResultsresults = plPileLine.Invoke();
                plPileLine.Stop();
                runspace.Close();
                runspace.Dispose();
    Cheers
    Glen
    • Marked as answer by GeorgiIvanov Thursday, August 22, 2013 6:34 AM
    Tuesday, August 20, 2013 2:56 AM
  • Thanks Glen, it works.
    Thursday, August 22, 2013 6:35 AM
  • Hi, Glen. I just wanted to clarify something about your answer.

    You mention that the old create-proxy-for-folder via EWS approach no longer works for Exchange 2013. Is this true for Exchange 2010 as well? Like the OP, I find the method in the linked post failing: calling Folder.Update while setting PR_PF_PROXY_REQUIRED to True raises an "invalid values" exception. This happens in my code, as well as in EWSEditor, which can read this property, but apparently not write to it.

    Is using PowerShell the only way to achieve this? The code sample you provided executes PowerShell commandlets to achieve this, but is this a realistic scenario? Do I need full admin access to the Exchange server, and do I need to install a PowerShell Remoting component to achieve this? 


    Monday, September 30, 2013 12:42 PM
  • As far as I know those properties are ReadOnly and the change occurred sometime in 2010 .

    Yes PowerShell is the only supported way of doing this and its realistic scenario that used in many applications (and works well).

    You need to be delegated rights to run that cmdlet http://blogs.msdn.com/b/anthonw/archive/2011/01/21/beyond-rbac-delegating-the-mail-enable-public-folders-right.aspx and also have Remote shell rights http://technet.microsoft.com/en-us/library/dd298084(v=exchg.141).aspx.

    All you need is Powershell v2 which includes WinRm

    Cheers
    Glen

    Tuesday, October 1, 2013 2:27 AM
  • Hi, Glen.

    I noticed your first link contained instructions on how to give my user account permissions to mail-enable a public folder. I tried running the scripts supplied, and can now et a value to PR_PF_PROXY_REQUIRED through my EWS code as well!

    This appears to be only a partial solution. the Public Folder Management Console displays my new folder as Mail Enabled, but displays an error when viewing its Email Address, apparently since no AD proxy was created. It seems that an additional manual step - creating the AD proxy - might do the trick. 

    I realize it might not be a supported scenario (which is an issue, indeed), but mixing PS code with my C# code (a scripting language that none of the project developers are familiar with) introduces a "black box" piece of voodoo code that might come and bite us later on. I'd rather get things working with familiar EWS, even if it requires breaking it down to smaller steps.

    Tuesday, October 1, 2013 11:45 AM