Collaboration-2-Go


Lösungen und Software-Entwicklung im Collaboration Umfeld, insbesondere Microsoft SharePoint, Microsoft Exchange und Microsoft Office.

Support


Mobil: +49 (152) 53 97 78 79
Mail: service@collaboration-2-go.de
Weitere Kontaktmöglichkeiten: Kontaktseite
Dekoration: Köln



How to create Exchange Public Folders for Appointments
Created: 04.10.2011
Categories: Exchange Development; Exchange; PowerShell

      Unfortunately the PowerShell cmdlet New-PublicFolder doesn’t allow different types for public folders. But with a small trick you can set the type later. The code requires CDOEX that runs locally only.

      PowerShell Code:
      
      $FolderPath = "/TEMP"
      $NewFolder = "CalendarTest"
      $PFRoot = "file://./backofficestorage/litwareinc.com/Public Folders"

      # Use PowerShell cmdlet to create new folder
      # (depending upon whether a root folder or not)
      if ($FolderPath -ne "")
      {
        $f = $FolderPath -replace("/", "\")
        New-PublicFolder -Name $NewFolder -Path $f
      }
      else
      {
        New-PublicFolder -Name $NewFolder
      }

      # Use ADO to change the folder type
      $o=New-Object -comobject ADODB.Record
      $updated=$false
      $timeout=60
      while (($updated -eq $false) -and ($timeout -gt 0))
      {
        $o.Open($PFRoot + $FolderPath + "/" +
         $NewFolder, "", 3, -1, -1, "", "")
        foreach($item in $o.Fields)
        {
        if($item.Name -eq
          "http://schemas.microsoft.com/exchange/outlookfolderclass")
        {
          $updated=$true
          $item.Value="IPF.Appointment"
        }
      }

      $o.Fields.Update()
      $o.Close()

      if ($updated -eq $false)
      {
      Start-Sleep -s 1
      $timeout --
      }
      }
      

      Tested IPF Types: IPF.Post, IPF.Contact, IPF.Appointment, IPF.Task
      Tested Exchange Version: Exchange 2007
    

Send us a Comment!