Outlook Delegates and Sending meeting invitations on behalf of the principal RRS feed

  • Question

  • I would like to learn whether or not I can send a meeting message on behalf of a principal using only Outlook '03/07 Calendaring Properties delegate permissions.  Our web admin does not want to set delegate access permissions on the Exchange server if at all possible.


    I have clipped and modified the following code from MSDN at


    One notation in that article is:


    Setting delegate access permission is a prerequisite for this code example. For information about how to set delegate access permission, see Add- MailboxPermission.


    Our Exchange Admin believes this step is not required if the principal sets up the service acct/delegate using Outlook 03/07 only.  I'm inclined to agree because the code basically works with Outlook only delegate permissions defined AND SendToNone set on the SendMeetingInvitations property.  If SendMeetingInvitations is set to SendToAllAndSaveCopy, the code fails with ErrorItemNotFound - which can also indicate insufficient permissions.  When set to SendToNone the meeting is properly added to the principal's calendar however no invitations are sent... an obvious problem. 


    Even though the call to createitem fails with ErrorItemNotFound in the case above, the meeting is still inserted in the principal's calendar.  My initial assumption was the delegate did not have email permissions for the principal mailbox because it failed to send the invitations and turning off the sendtoallandsavecopy bypassed the error.    But that didn't hold up because i am able to send email on behalf of the principal using EWS. 


    Can anyone tell me if it's possible to send on behalf of a principal given only permissions provided in Outlook?  Or must delegate permissions be set using Add-MailboxPermission? 


    Thank you for any information.  Smile


    static void CreateAndSendMeetingOnBehalfOfPrincipal()
        // Set the version, credentials, and the Client Access server on ExchangeServiceBinding.
        ExchangeServiceBinding esb = new ExchangeServiceBinding();
        esb.RequestServerVersionValue = new RequestServerVersion();
        esb.RequestServerVersionValue.Version = ExchangeVersionType.Exchange2007_SP1;
        esb.Credentials = new NetworkCredential("user2", "password", "domain");
        esb.Url = "";

        // Create the request and specify how the item is handled.
        CreateItemType request = new CreateItemType();
        request.MessageDisposition = MessageDispositionType.SendAndSaveCopy;
        request.MessageDispositionSpecified = true;
        request.SendMeetingInvitations = CalendarItemCreateOrDeleteOperationType.SendToAllAndSaveCopy;
        request.SendMeetingInvitationsSpecified = true;

        // Identify the principal's Calendar folder as the target folder for the calendar item.
        DistinguishedFolderIdType defCalendarFolder = new DistinguishedFolderIdType();
        defCalendarFolder.Id = DistinguishedFolderIdNameType.calendar;
        defCalendarFolder.Mailbox = new EmailAddressType();
        defCalendarFolder.Mailbox.EmailAddress = "";
        TargetFolderIdType target = new TargetFolderIdType();
        target.Item = defCalendarFolder;

        // Add the destination folder to the request.
        request.SavedItemFolderId = target;

        // Create the calendar item to start the meeting in one hour.
        CalendarItemType calendarItem = new CalendarItemType();
        calendarItem.Subject = "Delegate appointment";
        calendarItem.Body = new BodyType();
        calendarItem.Body.BodyType1 = BodyTypeType.Text;
        calendarItem.Body.Value = "This is the text of the delegate appointment.";
        calendarItem.Start = DateTime.Now.AddHours(1);
        calendarItem.StartSpecified = true;
        calendarItem.End = DateTime.Now.AddHours(2);
        calendarItem.EndSpecified = true;
        calendarItem.LegacyFreeBusyStatus = LegacyFreeBusyType.Busy;
        calendarItem.LegacyFreeBusyStatusSpecified = true;

        // Add attendee to calendar item.
        AttendeeType attendee1 = new AttendeeType();
        attendee1.Mailbox = new EmailAddressType();
        attendee1.Mailbox.EmailAddress = "";
        calendarItem.RequiredAttendees = new AttendeeType[] { attendee1 };

        // Add the calendar item to the request.
        request.Items = new NonEmptyArrayOfAllItemsType();
        request.Items.Items = new ItemType[] { calendarItem };

            // Send the request and get the response.
            CreateItemResponseType response = esb.CreateItem(request);

            // Get the response messsages.
            ResponseMessageType[] rmta = response.ResponseMessages.Items;

            foreach (ResponseMessageType rmt in rmta)
                ArrayOfRealItemsType itemArray = ((ItemInfoResponseMessageType)rmt).Items;
                ItemType[] items = itemArray.Items;

                // Get the item identifier for the meeting.
                foreach (ItemType item in items)
                    Console.WriteLine("Item identifier: " + item.ItemId.Id);
            // Handle exception.

    Wednesday, April 16, 2008 7:02 PM