title: Add-MailboxFolderPermission throws cast exception AdGroup to AdUser
body: <p>Currently I'm getting trouble in setting the calendar permission of a group for all members to Reviewer. According to <a href="https://docs.microsoft.com/en-us/powershell/module/exchange/mailboxes/add-mailboxfolderpermission?view=exchange-ps" rel="nofollow noreferrer">the documentation</a> and <a href="https://www.michev.info/Blog/Post/2760/managing-folder-level-permissions-for-office-365-groups" rel="nofollow noreferrer">this blog entry</a>, it should look like this:</p>
  
  <pre><code>Add-MailboxFolderPermission -Identity 3c3558e5-11bd-4ad7-8580-2f0fc7c590d7:\Calendar -GroupMailbox -User "Member@local" -AccessRights Reviewer
  </code></pre>
  
  <p>But unfortunately it throws an exception:</p>
  
  <blockquote>
    <p>Unable to cast object of type
    'Microsoft.Exchange.Data.Directory.Recipient.ADGroup' to type
    'Microsoft.Exchange.Data.Directory.Recipient.ADUser'.
        + CategoryInfo          : NotSpecified: (:) [Add-MailboxFolderPermission], InvalidCastException
        + FullyQualifiedErrorId : System.InvalidCastException,Microsoft.Exchange.Management.StoreTasks.AddMailboxFolderPer
    mission
        + PSComputerName        : outlook.office365.com</p>
  </blockquote>
  
  <p>Currently no entry is existing on this object for this <em>user</em>:</p>
  
  <pre><code>Get-MailboxFolderPermission -Identity 3c3558e5-11bd-4ad7-8580-2f0fc7c590d7:\Calendar -GroupMailbox
  
  FolderName           User                 AccessRights                           SharingPermissionFlags
  ----------           ----                 ------------                           ----------------------
  Calendar             Standard             {AvailabilityOnly}
  Calendar             Anonym               {None}
  Calendar             Owner@local          {Editor}
  </code></pre>
  
  <p>So, any idea why this isn't working?</p>