none
Getting the organizer of a CalendarItem of a room resource from an Exchange Server with C# RRS feed

  • Question

  • Hello everyone,

    in our software we are using EWS (not EWS Managed API) and we are sending XML SOAP Requests to our Exchange Server and  we process the data we receive.

    At the moment I have the problem to determine a person who created an appointment (Ogranizer) within a room ressource. I am trying to reach this goal via a FindItem request and for example I get the right data for item:Subject, calendar:Start and calendar:End. Thus I receive a valid CalendarItem in the response, if it exists. I used this tutorial in the link I am providing:

    https://msdn.microsoft.com/de-de/library/office/dn495614%28v=exchg.150%29.aspx

    Now if I am trying to get the organizer of one or more of those CalendarItems I receive something like this (I've shortened the Ids and ChangeKeys and only put in 2 items of the 5):

    <m:FindItemResponseMessage ResponseClass="Success">
       <m:ResponseCode>NoError</m:ResponseCode>
       <m:RootFolder TotalItemsInView="5" IncludesLastItemInRange="true">
           <t:Items>
              <t:CalendarItem>
                <t:ItemId Id="AAMk" ChangeKey="DwAAA" />
                <t:Subject>Manual test</t:Subject>
                <t:Start>2017-05-31T06:00:00Z</t:Start>
                <t:End>2017-05-31T06:30:00Z</t:End>
                <t:Organizer>
                   <t:Mailbox>
                     <t:Name>Attic</t:Name>
                     <t:EmailAddress>/O=FIRST ORGANIZATION/OU=EXCHANGE ADMINISTRATIVE GROUP (FYDIBOHF23SPDLT)/CN=RECIPIENTS/CN=BEC84A39E42B4FECAE34D476A673496B-DACHG</t:EmailAddress>
                     <t:RoutingType>EX</t:RoutingType>
                     <t:MailboxType>OneOff</t:MailboxType>
                   </t:Mailbox>
                    </t:Organizer>
               </t:CalendarItem>
               <t:CalendarItem>
                  <t:ItemId Id="AAMk" ChangeKey="DwAAA" />
                  <t:Subject>Ad hoc reservation</t:Subject>
                  <t:Start>2017-05-31T10:15:00Z</t:Start>
                  <t:End>2017-05-31T10:45:00Z</t:End>
                  <t:Organizer>
                     <t:Mailbox>
                        <t:Name>Attic</t:Name>
                        <t:EmailAddress>/O=FIRST ORGANIZATION/OU=EXCHANGE ADMINISTRATIVE GROUP (FYDIBOHF23SPDLT)/CN=RECIPIENTS/CN=BEC84A39E42B4FECAE34D476A673496B-DACHG</t:EmailAddress>
                        <t:RoutingType>EX</t:RoutingType>
                       <t:MailboxType>OneOff</t:MailboxType>
                     </t:Mailbox>
                  </t:Organizer>
                </t:CalendarItem>
            </t:Items>
        </m:RootFolder>
    </m:FindItemResponseMessage>

    I inserted the first appointment/item manually with my Exchange Account and I expected to see my name but instead I get the name of the room ressource as in the second item which was inserted via our software. Now I've tried to achieve the same goal with EWS Managed API in a test program, but with a "normal" mailbox (Please assume that serviceObject is a valid ExchangeService object and start, end are valid DateTime objects):

    var appointments = serviceObject.FindAppointments(WellKnownFolderName.Calendar, new CalendarView(start, end)));
    foreach(var appointment in appointments)
    {
        Console.WriteLine("Termin: Start->{0} Ende->{1} Ersteller->{2}", appointment.Start.ToString(),
        appointment.End.ToString(), appointment.Organizer.Name);
    }

    This seems to work great. But as stated in the beginning we aren't using the EWS Managed API but just EWS SOAP requests. Can this be achieved with "plain" EWS and if yes could you help me?

    Thank you for your time and effort.

    Kind regards,

    Marc

    Thursday, June 1, 2017 1:06 PM

Answers

All replies

  • >>This seems to work great. But as stated in the beginning we aren't using the EWS Managed API but just EWS SOAP requests. Can this be achieved with "plain" EWS and if yes could you help me?

    If you enable tracing with the EWS Managed API in your test https://msdn.microsoft.com/en-us/library/office/dd633676(v=exchg.80).aspx that will output the exact XML you will need to use in your other app to replicate the same thing which should help solve your issue.

    Cheers
    Glen

    Friday, June 2, 2017 6:04 AM
  • Hey Glen,

    thank you. That points me into the right direction from where on out I can investigate more.

    Cheers,

    Marc

    Friday, June 2, 2017 7:44 AM
  • Alright, I've tested around a bit.

    I created 3 appointments in one of my colleagues calendar to which I have full access to, so that I can create and delete appointments.

    The 1st appointment was created by him. The 2nd appointment was created by me. The third one was created by him and modified by me. His name will be shortened to BB in following EWS Request and Response Trace as well in the output from the EWS API test program:

    <Trace Tag="EwsRequest" Tid="9" Time="2017-06-02 08:47:09Z" Version="15.00.0847.030">
      <?xml version="1.0" encoding="utf-8"?>
      <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
        <soap:Header>
          <t:RequestServerVersion Version="Exchange2007_SP1" />
          <t:TimeZoneContext>
            <t:TimeZoneDefinition Id="W. Europe Standard Time" />
          </t:TimeZoneContext>
        </soap:Header>
        <soap:Body>
          <m:FindItem Traversal="Shallow">
            <m:ItemShape>
              <t:BaseShape>AllProperties</t:BaseShape>
            </m:ItemShape>
            <m:CalendarView StartDate="2017-06-01T22:00:00.000Z" EndDate="2017-06-02T22:00:00.000Z" />
            <m:ParentFolderIds>
              <t:DistinguishedFolderId Id="calendar" />
            </m:ParentFolderIds>
          </m:FindItem>
        </soap:Body>
      </soap:Envelope>
    </Trace>
    <Trace Tag="EwsResponse" Tid="9" Time="2017-06-02 08:47:09Z" Version="15.00.0847.030">
      <?xml version="1.0" encoding="utf-8"?>
      <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
        <s:Header>
          <h:ServerVersionInfo MajorVersion="15" MinorVersion="0" MajorBuildNumber="847" MinorBuildNumber="31" Version="V2_8" xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
        </s:Header>
        <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
          <m:FindItemResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
            <m:ResponseMessages>
              <m:FindItemResponseMessage ResponseClass="Success">
                <m:ResponseCode>NoError</m:ResponseCode>
                <m:RootFolder TotalItemsInView="3" IncludesLastItemInRange="true">
                  <t:Items>
                    <t:CalendarItem>
                      <t:ItemId Id="AQMkA" ChangeKey="DwAAA" />
                      <t:ParentFolderId Id="AQMkA" ChangeKey="AQAAA" />
                      <t:ItemClass>IPM.Appointment</t:ItemClass>
                      <t:Subject>BB Creator</t:Subject>
                      <t:Sensitivity>Normal</t:Sensitivity>
                      <t:DateTimeReceived>2017-06-02T08:38:08Z</t:DateTimeReceived>
                      <t:Size>7116</t:Size>
                      <t:Importance>Normal</t:Importance>
                      <t:IsSubmitted>false</t:IsSubmitted>
                      <t:IsDraft>false</t:IsDraft>
                      <t:IsFromMe>false</t:IsFromMe>
                      <t:IsResend>false</t:IsResend>
                      <t:IsUnmodified>false</t:IsUnmodified>
                      <t:DateTimeSent>2017-06-02T08:38:08Z</t:DateTimeSent>
                      <t:DateTimeCreated>2017-06-02T08:38:10Z</t:DateTimeCreated>
                      <t:ReminderDueBy>2017-06-02T06:00:00Z</t:ReminderDueBy>
                      <t:ReminderIsSet>false</t:ReminderIsSet>
                      <t:ReminderMinutesBeforeStart>15</t:ReminderMinutesBeforeStart>
                      <t:DisplayCc />
                      <t:DisplayTo>BB</t:DisplayTo>
                      <t:HasAttachments>false</t:HasAttachments>
                      <t:Culture>de-DE</t:Culture>
                      <t:EffectiveRights>
                        <t:CreateAssociated>false</t:CreateAssociated>
                        <t:CreateContents>false</t:CreateContents>
                        <t:CreateHierarchy>false</t:CreateHierarchy>
                        <t:Delete>true</t:Delete>
                        <t:Modify>true</t:Modify>
                        <t:Read>true</t:Read>
                      </t:EffectiveRights>
                      <t:LastModifiedName>BB</t:LastModifiedName>
                      <t:LastModifiedTime>2017-06-02T08:38:30Z</t:LastModifiedTime>
                      <t:UID>040000008200E00074C5B7101A82E00800000000B07004538CDBD201000000000000000010000000F2F25863CC97FF42B92D632C3F480914</t:UID>
                      <t:DateTimeStamp>2017-06-02T08:38:30Z</t:DateTimeStamp>
                      <t:Start>2017-06-02T06:00:00Z</t:Start>
                      <t:End>2017-06-02T06:30:00Z</t:End>
                      <t:IsAllDayEvent>false</t:IsAllDayEvent>
                      <t:LegacyFreeBusyStatus>Busy</t:LegacyFreeBusyStatus>
                      <t:Location />
                      <t:IsMeeting>false</t:IsMeeting>
                      <t:IsCancelled>false</t:IsCancelled>
                      <t:IsRecurring>false</t:IsRecurring>
                      <t:MeetingRequestWasSent>false</t:MeetingRequestWasSent>
                      <t:IsResponseRequested>true</t:IsResponseRequested>
                      <t:CalendarItemType>Single</t:CalendarItemType>
                      <t:MyResponseType>Unknown</t:MyResponseType>
                      <t:Organizer>
                        <t:Mailbox>
                          <t:Name>BB</t:Name>
                          <t:EmailAddress>/o=First Organization/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=user2d0f8a59</t:EmailAddress>
                          <t:RoutingType>EX</t:RoutingType>
                        </t:Mailbox>
                      </t:Organizer>
                      <t:Duration>PT30M</t:Duration>
                      <t:TimeZone>(UTC+01:00) Amsterdam, Berlin, Bern, Rom, Stockholm, Wien</t:TimeZone>
                      <t:AppointmentSequenceNumber>0</t:AppointmentSequenceNumber>
                      <t:AppointmentState>0</t:AppointmentState>
                      <t:ConferenceType>0</t:ConferenceType>
                      <t:AllowNewTimeProposal>true</t:AllowNewTimeProposal>
                      <t:NetShowUrl />
                    </t:CalendarItem>
                    <t:CalendarItem>
                      <t:ItemId Id="AAMkA" ChangeKey="DwAAA" />
                      <t:ParentFolderId Id="AQMkA" ChangeKey="AQAAA" />
                      <t:ItemClass>IPM.Appointment</t:ItemClass>
                      <t:Subject>Marc Creator</t:Subject>
                      <t:Sensitivity>Normal</t:Sensitivity>
                      <t:DateTimeReceived>2017-06-02T08:38:26Z</t:DateTimeReceived>
                      <t:Size>7630</t:Size>
                      <t:Importance>Normal</t:Importance>
                      <t:IsSubmitted>false</t:IsSubmitted>
                      <t:IsDraft>false</t:IsDraft>
                      <t:IsFromMe>false</t:IsFromMe>
                      <t:IsResend>false</t:IsResend>
                      <t:IsUnmodified>false</t:IsUnmodified>
                      <t:DateTimeSent>2017-06-02T08:38:26Z</t:DateTimeSent>
                      <t:DateTimeCreated>2017-06-02T08:38:49Z</t:DateTimeCreated>
                      <t:ReminderDueBy>2017-06-02T07:00:00Z</t:ReminderDueBy>
                      <t:ReminderIsSet>true</t:ReminderIsSet>
                      <t:ReminderMinutesBeforeStart>15</t:ReminderMinutesBeforeStart>
                      <t:DisplayCc />
                      <t:DisplayTo>BB</t:DisplayTo>
                      <t:HasAttachments>false</t:HasAttachments>
                      <t:Culture>de-DE</t:Culture>
                      <t:EffectiveRights>
                        <t:CreateAssociated>false</t:CreateAssociated>
                        <t:CreateContents>false</t:CreateContents>
                        <t:CreateHierarchy>false</t:CreateHierarchy>
                        <t:Delete>true</t:Delete>
                        <t:Modify>true</t:Modify>
                        <t:Read>true</t:Read>
                      </t:EffectiveRights>
                      <t:LastModifiedName>Marc Rau</t:LastModifiedName>
                      <t:LastModifiedTime>2017-06-02T08:38:15Z</t:LastModifiedTime>
                      <t:UID>040000008200E00074C5B7101A82E008000000009013035E8CDBD201000000000000000010000000C7D20C0362D9C34B9872ADAE7FBDE012</t:UID>
                      <t:DateTimeStamp>2017-06-02T08:38:15Z</t:DateTimeStamp>
                      <t:Start>2017-06-02T07:00:00Z</t:Start>
                      <t:End>2017-06-02T07:30:00Z</t:End>
                      <t:IsAllDayEvent>false</t:IsAllDayEvent>
                      <t:LegacyFreeBusyStatus>Busy</t:LegacyFreeBusyStatus>
                      <t:Location />
                      <t:IsMeeting>false</t:IsMeeting>
                      <t:IsCancelled>false</t:IsCancelled>
                      <t:IsRecurring>false</t:IsRecurring>
                      <t:MeetingRequestWasSent>false</t:MeetingRequestWasSent>
                      <t:IsResponseRequested>true</t:IsResponseRequested>
                      <t:CalendarItemType>Single</t:CalendarItemType>
                      <t:MyResponseType>Unknown</t:MyResponseType>
                      <t:Organizer>
                        <t:Mailbox>
                          <t:Name>BB</t:Name>
                          <t:EmailAddress>/O=FIRST ORGANIZATION/OU=EXCHANGE ADMINISTRATIVE GROUP (FYDIBOHF23SPDLT)/CN=RECIPIENTS/CN=USER2D0F8A59</t:EmailAddress>
                          <t:RoutingType>EX</t:RoutingType>
                        </t:Mailbox>
                      </t:Organizer>
                      <t:Duration>PT30M</t:Duration>
                      <t:TimeZone>(UTC+01:00) Amsterdam, Berlin, Bern, Rom, Stockholm, Wien</t:TimeZone>
                      <t:AppointmentSequenceNumber>0</t:AppointmentSequenceNumber>
                      <t:AppointmentState>0</t:AppointmentState>
                      <t:ConferenceType>0</t:ConferenceType>
                      <t:AllowNewTimeProposal>true</t:AllowNewTimeProposal>
                      <t:NetShowUrl />
                    </t:CalendarItem>
                    <t:CalendarItem>
                      <t:ItemId Id="AQMkA" ChangeKey="DwAAA" />
                      <t:ParentFolderId Id="AQMkA" ChangeKey="AQAAA" />
                      <t:ItemClass>IPM.Appointment</t:ItemClass>
                      <t:Subject>Björn Creator modified by Marc</t:Subject>
                      <t:Sensitivity>Normal</t:Sensitivity>
                      <t:DateTimeReceived>2017-06-02T08:39:27Z</t:DateTimeReceived>
                      <t:Size>7783</t:Size>
                      <t:Importance>Normal</t:Importance>
                      <t:IsSubmitted>false</t:IsSubmitted>
                      <t:IsDraft>false</t:IsDraft>
                      <t:IsFromMe>false</t:IsFromMe>
                      <t:IsResend>false</t:IsResend>
                      <t:IsUnmodified>false</t:IsUnmodified>
                      <t:DateTimeSent>2017-06-02T08:39:27Z</t:DateTimeSent>
                      <t:DateTimeCreated>2017-06-02T08:39:50Z</t:DateTimeCreated>
                      <t:ReminderDueBy>2017-06-02T11:00:00Z</t:ReminderDueBy>
                      <t:ReminderIsSet>true</t:ReminderIsSet>
                      <t:ReminderMinutesBeforeStart>15</t:ReminderMinutesBeforeStart>
                      <t:DisplayCc />
                      <t:DisplayTo>BB</t:DisplayTo>
                      <t:HasAttachments>false</t:HasAttachments>
                      <t:Culture>de-DE</t:Culture>
                      <t:EffectiveRights>
                        <t:CreateAssociated>false</t:CreateAssociated>
                        <t:CreateContents>false</t:CreateContents>
                        <t:CreateHierarchy>false</t:CreateHierarchy>
                        <t:Delete>true</t:Delete>
                        <t:Modify>true</t:Modify>
                        <t:Read>true</t:Read>
                      </t:EffectiveRights>
                      <t:LastModifiedName>Marc Rau</t:LastModifiedName>
                      <t:LastModifiedTime>2017-06-02T08:40:42Z</t:LastModifiedTime>
                      <t:UID>040000008200E00074C5B7101A82E0080000000040D661828CDBD201000000000000000010000000277DA6F7BFF7EB49BA72FF5E6EA5640B</t:UID>
                      <t:DateTimeStamp>2017-06-02T08:40:42Z</t:DateTimeStamp>
                      <t:Start>2017-06-02T11:00:00Z</t:Start>
                      <t:End>2017-06-02T12:00:00Z</t:End>
                      <t:IsAllDayEvent>false</t:IsAllDayEvent>
                      <t:LegacyFreeBusyStatus>Busy</t:LegacyFreeBusyStatus>
                      <t:Location />
                      <t:IsMeeting>false</t:IsMeeting>
                      <t:IsCancelled>false</t:IsCancelled>
                      <t:IsRecurring>false</t:IsRecurring>
                      <t:MeetingRequestWasSent>false</t:MeetingRequestWasSent>
                      <t:IsResponseRequested>true</t:IsResponseRequested>
                      <t:CalendarItemType>Single</t:CalendarItemType>
                      <t:MyResponseType>Unknown</t:MyResponseType>
                      <t:Organizer>
                        <t:Mailbox>
                          <t:Name>BB</t:Name>
                          <t:EmailAddress>/o=First Organization/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=user2d0f8a59</t:EmailAddress>
                          <t:RoutingType>EX</t:RoutingType>
                        </t:Mailbox>
                      </t:Organizer>
                      <t:Duration>PT1H</t:Duration>
                      <t:TimeZone>(UTC+01:00) Amsterdam, Berlin, Bern, Rom, Stockholm, Wien</t:TimeZone>
                      <t:AppointmentSequenceNumber>0</t:AppointmentSequenceNumber>
                      <t:AppointmentState>0</t:AppointmentState>
                      <t:ConferenceType>0</t:ConferenceType>
                      <t:AllowNewTimeProposal>true</t:AllowNewTimeProposal>
                      <t:NetShowUrl />
                    </t:CalendarItem>
                  </t:Items>
                </m:RootFolder>
              </m:FindItemResponseMessage>
            </m:ResponseMessages>
          </m:FindItemResponse>
        </s:Body>
      </s:Envelope>
    </Trace>
    Appointment: Start->02.06.2017 08:00:00  End->02.06.2017 08:30:00  Organizer->BB
    Appointment: Start->02.06.2017 09:00:00  End->02.06.2017 09:30:00  Organizer->BB
    Appointment: Start->02.06.2017 13:00:00  End->02.06.2017 14:00:00  Organizer->BB
    So, I can see that I modified one of his appointments, but I can't see that I created the 2nd appointment? Seems odd to me.

    Friday, June 2, 2017 9:08 AM
  • Maybe try using the PidTagCreatorName  https://msdn.microsoft.com/en-us/library/ee203019(v=exchg.80).aspx extended property that should reflect the account used to create the Item
    • Marked as answer by Marc Rau Thursday, June 8, 2017 7:22 AM
    Monday, June 5, 2017 7:07 AM
  • Hello Glen,

    sorry, that I couldn't get to you sooner. I've tested this with my test program as well as with our software and it works flawlessly for a calendar that is belonging to an exchange account with a real mailbox.

    One last question though. Do you know why this is not working for a room ressource? This room ressource doesn't really belong to our domain and is just a ressource. Is it normal for these ressources that they always claim that they are the creator of the appointment within a calendar or could it be that this ressource is configured in a wrong way?

    Cheers.

    Thursday, June 8, 2017 7:22 AM