lib/ews/types/mailbox_user.rb
def add_delegate!(delegate_email, permissions)
      # Use a new hash so the passed hash is not modified in case we are in a loop.
      # Thanks to Markus Roberts for pointing this out.
      formatted_perms = {}
      # Modify permissions so we can pass it to the builders
      permissions.each_pair do |k,v|
        formatted_perms[k] = {:text => v}
      end

      resp = (Viewpoint::EWS::EWS.instance).ews.add_delegate(self.email_address, delegate_email, formatted_perms)
      if(resp.status == 'Success')
        return true
      else
        raise EwsError, "Could not add delegate access for user #{delegate_email}: #{resp.code}, #{resp.message}"
      end
    end
def add_delegate!(delegate_email, permissions)
      # Use a new hash so the passed hash is not modified in case we are in a loop.
      # Thanks to Markus Roberts for pointing this out.
      formatted_perms = {}
      # Modify permissions so we can pass it to the builders
      permissions.each_pair do |k,v|
        formatted_perms[k] = {:text => v}
      end

      resp = (Viewpoint::EWS::EWS.instance).ews.add_delegate(self.email_address, delegate_email, formatted_perms)
      if(resp.status == 'Success')
        return true
      else
        raise EwsError, "Could not add delegate access for user #{delegate_email}: #{resp.code}, #{resp.message}"
      end
    end
Adds one or more delegates to a principal's mailbox and sets specific access permissions
 @see http://msdn.microsoft.com/en-us/library/bb856527.aspx

 @param [String,MailboxUser] delegate_email The user you would like to give delegate access to.
   This can either be a simple String e-mail address or you can pass in a MailboxUser object.
 @param [Hash] permissions A hash of folder type keys and permission type values. An example
   would be {:calendar_folder_permission_level => 'Editor'}.  Possible keys are:
   :calendar_folder_permission_level, :tasks_folder_permission_level, :inbox_folder_permission_level
   :contacts_folder_permission_level, :notes_folder_permission_level, :journal_folder_permission_level
   and possible values are:  None/Editor/Reviewer/Author/Custom
 @return [true] This method either returns true or raises an error with the message
   as to why this operation did not succeed.