Exemplo n.º 1
0
 /// <remarks/>
 public void GetItemAsync(GetItemType GetItem1, object userState)
 {
     if ((this.GetItemOperationCompleted == null))
     {
         this.GetItemOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetItemOperationCompleted);
     }
     this.InvokeAsync("GetItem", new object[] {
             GetItem1}, this.GetItemOperationCompleted, userState);
 }
Exemplo n.º 2
0
 /// <remarks/>
 public System.IAsyncResult BeginGetItem(GetItemType GetItem1, System.AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("GetItem", new object[] {
             GetItem1}, callback, asyncState);
 }
Exemplo n.º 3
0
 /// <remarks/>
 public void GetItemAsync(GetItemType GetItem1)
 {
     this.GetItemAsync(GetItem1, null);
 }
Exemplo n.º 4
0
        /// <summary>
        /// Gets a specific message from exchange by id (attachments are only loaded shallow).
        /// </summary>
        /// <param name="messageId"></param>
        /// <returns></returns>
        public MessageType GetMessage(string messageId)
        {
            var binding = ChannelHelper.BuildChannel(hostname, username, password);

            ItemIdType itemId = new ItemIdType();
            itemId.Id = messageId;

            GetItemType getItemRequest = new GetItemType();
            getItemRequest.ItemShape = new ItemResponseShapeType { BaseShape = DefaultShapeNamesType.AllProperties };
            getItemRequest.ItemIds = new[] { itemId };

            GetItemResponseType getItemResponse = binding.GetItem(getItemRequest);

            if (getItemResponse.ResponseMessages.Items[0].ResponseClass == ResponseClassType.Error)
                throw new Exception(getItemResponse.ResponseMessages.Items[0].MessageText);

            var getItemResponseMessage = (ItemInfoResponseMessageType)getItemResponse.ResponseMessages.Items[0];

            if (getItemResponseMessage.Items.Items == null || getItemResponseMessage.Items.Items.Length == 0)
                throw new ApplicationException("Error in GetMessage, empty ItemInfoResponseMessageType");

            return (MessageType)getItemResponseMessage.Items.Items[0];
        }