/********************************************************************
          * GET ITEM FOR ID SUPPLIED
          ********************************************************************/
        private static ItemType GetItemForID(String id)
        {
            ItemIdType iit = new ItemIdType();
            iit.Id = id;

            GetItemType git = new GetItemType();
            git.ItemIds = new ItemIdType[] { iit };
            git.ItemShape = new ItemResponseShapeType();
            git.ItemShape.BaseShape = DefaultShapeNamesType.AllProperties;

            GetItemResponseType girt = service.GetItem(git);

            if (girt.ResponseMessages.Items[0].ResponseClass == ResponseClassType.Error)
                throw new Exception(String.Format("Unable to get message item and Mime Content\r\n{0}\r\n{1}",
                                                                               girt.ResponseMessages.Items[0].ResponseCode,
                                                                               girt.ResponseMessages.Items[0].MessageText));
            ItemType message = null;
            if (girt.ResponseMessages.Items.Count() > 0)
                message = (((ItemInfoResponseMessageType)girt.ResponseMessages.Items[0]).Items.Items[0]);

            return message;
        }
        /********************************************************************
          * REPLY AN EMAIL WITH THE ITEMID AND THE REPLYBODY
          ********************************************************************/
        private static void Reply(String itemID, String replyBody)
        {

            ItemIdType iit = new ItemIdType();
            iit.Id = itemID;

            CreateItemType request = new CreateItemType();
            request.MessageDisposition = MessageDispositionType.SendAndSaveCopy;
            request.MessageDispositionSpecified = true;
            request.SavedItemFolderId = new TargetFolderIdType();
            request.SavedItemFolderId.Item = new DistinguishedFolderIdType();
            (request.SavedItemFolderId.Item as DistinguishedFolderIdType).Id = DistinguishedFolderIdNameType.sentitems;

            ReplyToItemType reply = new ReplyToItemType();
            // Id of the message to which to reply
            reply.ReferenceItemId = iit;
            reply.NewBodyContent = new LogicLayer.ExchangeWebServices.BodyType();
            reply.NewBodyContent.BodyType1 = BodyTypeType.HTML;
            reply.NewBodyContent.Value = replyBody;

            // Set additional properties on the reply object if you wish...
            CreateItemResponseType response = service.CreateItem(request);

            if (response.ResponseMessages.Items[0].ResponseClass == ResponseClassType.Success)
            {
                // Success, the reply was sent and saved in the SentItems folder.
                // NB: Since sending a message is an asynchronous operation, NO ITEM ID IS RETURNED.
                // To obtain the Id of the reply message, set the MessageDisposition flag above to SaveOnly.
                // The Id can be found in the response:
                // ItemIdType replyId = ((ItemInfoResponseMessageType)response.ResponseMessages.Items[0]).Items.Items[0].ItemId;
                // You can then call SendItem to send the message.
            }
            else
            {
                // An error has occurred
            }
        }
        /********************************************************************
          * MARK ITEM AS READ
          ********************************************************************/
        public static bool SetReadStatus(ItemIdType item)
        {
            SetItemFieldType setField = new SetItemFieldType();
            PathToUnindexedFieldType path = new PathToUnindexedFieldType();

            MessageType message = new MessageType();
            message.IsRead = true;
            message.IsReadSpecified = true;
            setField.Item1 = message;
            path.FieldURI = UnindexedFieldURIType.messageIsRead;

            setField.Item = path;
            ItemChangeType[] updatedItems = new ItemChangeType[1];
            updatedItems[0] = new ItemChangeType();
            updatedItems[0].Updates = new ItemChangeDescriptionType[1];
            updatedItems[0].Updates[0] = setField;

            ItemChangeDescriptionType[] updates = new ItemChangeDescriptionType[1];
            updates[0] = new ItemChangeDescriptionType();
            updates[0].Item = path;

            updatedItems[0].Item = new ItemIdType();
            ((ItemIdType)updatedItems[0].Item).Id = item.Id;
            ((ItemIdType)updatedItems[0].Item).ChangeKey = item.ChangeKey;
            UpdateItemType request = new UpdateItemType();
            request.ItemChanges = updatedItems;
            request.ConflictResolution = ConflictResolutionType.AutoResolve;
            request.MessageDisposition = MessageDispositionType.SaveOnly;
            request.MessageDispositionSpecified = true;

            UpdateItemResponseType response = service.UpdateItem(request);

            if (response.ResponseMessages.Items[0].ResponseClass !=
                                 ResponseClassType.Success)
                return false;
            else
                return true;
        }