Quantcast
Channel: Exchange Server Development forum
Viewing all articles
Browse latest Browse all 7132

Search appointment by ICal in EWS Managed

$
0
0

Hi all,

First of all, i have tried with the solution of henning however it dont seems to be the correct one... (http://www.infinitec.de/post/2009/04/13/Searching-a-meeting-with-a-specific-UID-using-Exchange-Web-Services-2007.aspx)

We have in our application the UniqueId of an appointment stored. So via this way we have an reference to the correct appointment of a user.
When we create a meeting we create based on the impersonated user. After that we iterate on all the attendees, impersonate each and get the appointment based on ICal.

With the solution of Henning, it seems that not always the correct Uid will be catched. Here is my code:

private Appointment FindAppointmentByICalUid(string iCalUid)
        {
            var filter = new SearchFilter.IsEqualTo
            {
                PropertyDefinition = new ExtendedPropertyDefinition
                  (DefaultExtendedPropertySet.Meeting, 0x03, MapiPropertyType.Binary),
                Value = GetObjectIdStringFromUid(iCalUid) //Hex value converted to byte and base64 encoded
            };

            var view = new ItemView( 1 ) { PropertySet = new PropertySet( BasePropertySet.FirstClassProperties ) };

            return _exchangeServer.FindItems(WellKnownFolderName.Calendar, filter, view).Items.FirstOrDefault() as Appointment;
        }

        /// <summary>
        /// Gets the object id string from uid.
        /// <remarks>The UID is formatted as a hex-string and the GlobalObjectId is displayed as a Base64 string.</remarks>
        /// </summary>
        /// <param name="iCalUid">The ICalUid</param>
        /// <returns></returns>
        private string GetObjectIdStringFromUid(string iCalUid)
        {
            var buffer = new byte[iCalUid.Length / 2];
            for (int i = 0; i < iCalUid.Length / 2; i++)
            {
                var hexValue = byte.Parse(iCalUid.Substring(i * 2, 2), System.Globalization.NumberStyles.AllowHexSpecifier);
                buffer[i] = hexValue;
            }
            return Convert.ToBase64String(buffer);
        }


Viewing all articles
Browse latest Browse all 7132

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>