float TargetActiveItemDis(GetItemType targetMoveType) { float getDis = ActiveItemDis; switch (targetMoveType) { case GetItemType.Up: if (mUIScrollView.currentMomentum.y < 0) { getDis += mPosHeight * 3; } else { getDis -= mPosHeight; } break; case GetItemType.Down: if (mUIScrollView.currentMomentum.y > 0) { getDis += mPosHeight * 3; } else { getDis -= mPosHeight; } break; case GetItemType.Left: if (mUIScrollView.currentMomentum.x > 0) { getDis += mPosWidth * 3; } else { getDis -= mPosWidth; } break; case GetItemType.Right: if (mUIScrollView.currentMomentum.x < 0) { getDis += mPosWidth * 3; } else { getDis -= mPosWidth; } break; } if (IsHorizontal) { DisableItemDis = ActiveItemDis + mPosWidth; } else { DisableItemDis = ActiveItemDis + mPosHeight; } return(getDis); }
protected EmployeeCollection GetCollection(GetItemType SelectType, string SearchString, int ReturnCount) { //notes: return collection of groups string strStoredProcName = "Elite_GetEmployee"; try { //notes: get base object properties you want hydrated and add any additional if necessary ObjectPropertyDictionary objProperties = this.GetBaseProperties(); objProperties.Add("label", SqlDbType.VarChar); objProperties.Add("value", SqlDbType.VarChar); //notes: set the parameters to use for this query ParameterCollection objParamCollection = new ParameterCollection(); objParamCollection.Add(ReturnCount.GetParameterInt("@ReturnCount")); switch (SelectType) { case GetItemType.BY_SEARCH: // 21 = GET_COLLECTION_BY_SEARCH objParamCollection.Add((21).GetParameterListValue()); objParamCollection.Add(SearchString.GetParameterVarchar("@SearchString", 300)); break; } //notes: call local method to get list return this.GetLocalCollection(objParamCollection, objProperties, strStoredProcName); } catch (Exception ex) { return new EmployeeCollection { StatusResult = new ResponseStatus("Get Employee Search Collection Error: " + ex.Message, ex.StackTrace, ResponseStatusResult.Fail) }; } }
protected internal IList <CalendarItemType> GetCalendarItems(ItemIdType[] itemIds) { if (itemIds.Length == 0) { return(new CalendarItemType[0]); } List <CalendarItemType> calendarItems = new List <CalendarItemType>(itemIds.Length); // Form the GetItem request. GetItemType getItemRequest = new GetItemType(); getItemRequest.ItemShape = new ItemResponseShapeType(); getItemRequest.ItemShape.BaseShape = DefaultShapeNamesType.AllProperties; getItemRequest.ItemIds = itemIds; GetItemResponseType getItemResponse = Service.GetItem(getItemRequest); foreach (ItemInfoResponseMessageType responseMessage in getItemResponse.ResponseMessages.Items) { if (responseMessage.ResponseClass == ResponseClassType.Success && responseMessage.Items.Items != null && responseMessage.Items.Items.Length > 0) { calendarItems.Add((CalendarItemType)responseMessage.Items.Items[0]); } } return(calendarItems.ToArray()); }
protected VendorItem GetItem(GetItemType SelectType, int VendorID) { string strStoredProcName = "jsp_Subscription_GetVendorItems"; try { //notes: set the parameters to use for this query ParameterCollection objParamCollection = new ParameterCollection(); switch (SelectType) { case GetItemType.BY_ID: objParamCollection.Add((10).GetParameterListValue()); objParamCollection.Add(VendorID.GetParameterInt("@VendorID")); break; } //notes: get base object properties you want hydrated and add any additional if necessary ObjectPropertyDictionary objProperties = this.GetBaseProperties(); //notes: call local method to get object item return this.GetLocalItem(objParamCollection, objProperties, strStoredProcName); } catch (Exception ex) { return new VendorItem { StatusResult = new ResponseStatus("Get Vendor Item Error: " + ex.Message, ex.StackTrace, ResponseStatusResult.Fail) }; } }
public ItemType[] GetItem(ItemIdType[] itemIds, StoreObjectType folderType) { ItemResponseShapeType itemShape; if (folderType == StoreObjectType.CalendarFolder) { itemShape = ExchangeService.CalendarGetItemShape; } else { itemShape = ExchangeService.ContactGetItemShape; } GetItemType request = new GetItemType { ItemShape = itemShape, ItemIds = itemIds }; ItemInfoResponseMessageType[] item = this.GetItem(request); List<ItemType> list = new List<ItemType>(item.Length); foreach (ItemInfoResponseMessageType itemInfoResponseMessageType in item) { if (itemInfoResponseMessageType.Items != null && itemInfoResponseMessageType.Items.Items != null && itemInfoResponseMessageType.Items.Items.Length != 0) { list.AddRange(itemInfoResponseMessageType.Items.Items); } } return list.ToArray(); }
protected Employee GetItem(GetItemType SelectType, int TKID, string FirstName, string LastName) { string strStoredProcName = "Elite_GetEmployee"; try { //notes: set the parameters to use for this query ParameterCollection objParamCollection = new ParameterCollection(); //notes: ListValue options switch (SelectType) { case GetItemType.BY_TKID: // 10 = GET_ITEM_BY_ID objParamCollection.Add((10).GetParameterListValue()); objParamCollection.Add(TKID.GetParameterInt("@TKID")); break; } //notes: get base object properties you want hydrated and add any additional if necessary ObjectPropertyDictionary objProperties = this.GetBaseProperties(); //notes: call local method to get object item return this.GetLocalItem(objParamCollection, objProperties, strStoredProcName); } catch (Exception ex) { return new Employee { StatusResult = new ResponseStatus("Get Item by ID Error: " + ex.Message, ex.StackTrace, ResponseStatusResult.Fail) }; } }
protected SubscriptionItemCollection GetCollection(GetItemType SelectType) { //notes: return collection of groups string strStoredProcName = "jsp_Subscription_GetSubscriptionItems"; try { //notes: get base object properties you want hydrated and add any additional if necessary ObjectPropertyDictionary objProperties = this.GetBaseProperties(); objProperties.Add("EmployeeName", SqlDbType.VarChar); //notes: set the parameters to use for this query ParameterCollection objParamCollection = new ParameterCollection(); switch (SelectType) { case GetItemType.BY_ALL: objParamCollection.Add((20).GetParameterListValue()); break; } //notes: call local method to get list return this.GetLocalCollection(objParamCollection, objProperties, strStoredProcName); } catch (Exception ex) { return new SubscriptionItemCollection { StatusResult = new ResponseStatus("Get Subscription Collection Error: " + ex.Message, ex.StackTrace, ResponseStatusResult.Fail) }; } }
List <int> GetNextShowItemIndex(GetItemType getType)//一次只获取一行 { bool getMin = getType == GetItemType.Left || getType == GetItemType.Up; GetIndexGroup.Clear(); int getIndex = getMin ? 9999 : 0; for (int i = 0; i < mActiveDragChildGroup.Count; i++) { var child = mActiveDragChildGroup[i]; getIndex = getMin ? (child.mIndex < getIndex ? child.mIndex : getIndex) : (child.mIndex > getIndex ? child.mIndex : getIndex); } getIndex = getMin ? (getIndex - 1) : (getIndex + 1); if (getMin) { while (getIndex >= 0 && (GetIndexGroup.Count < (getType == GetItemType.Up?mWidthNum:1))) { GetIndexGroup.Add(getIndex); getIndex--; } } else { int dataCount = mDataDic.Count; while (getIndex <= (dataCount - 1) && (GetIndexGroup.Count < (getType == GetItemType.Up ?mWidthNum:1))) { GetIndexGroup.Add(getIndex); getIndex++; } } return(GetIndexGroup); }
/// <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]); }
/// <summary> /// Get tasks on the server according to items' id. /// </summary> /// <param name="itemIds">The item id of task which will be gotten.</param> /// <returns>The got task items array.</returns> protected TaskType[] GetTasks(params ItemIdType[] itemIds) { GetItemType getItemRequest = TestSuiteHelper.GenerateGetItemRequest(itemIds); // Get the GetItem response from the server by using the ItemId got from createItem response. GetItemResponseType getItemResponse = this.TASKAdapter.GetItem(getItemRequest); this.VerifyResponseMessage(getItemResponse); return(Common.GetItemsFromInfoResponse <TaskType>(getItemResponse)); }
/// <summary> /// Get items on the server. /// </summary> /// <param name="getItemRequest">Specify a request to get items on the server.</param> /// <returns>A response to this operation request.</returns> public GetItemResponseType GetItem(GetItemType getItemRequest) { if (getItemRequest == null) { throw new ArgumentException("The GetItem request should not be null."); } GetItemResponseType response = this.exchangeServiceBinding.GetItem(getItemRequest); return(response); }
/// <summary> /// Get contact item on the server. /// </summary> /// <param name="getItemRequest">The request of GetItem operation.</param> /// <returns>A response to GetItem operation request.</returns> public GetItemResponseType GetItem(GetItemType getItemRequest) { GetItemResponseType getItemResponse = this.exchangeServiceBinding.GetItem(getItemRequest); Site.Assert.IsNotNull(getItemResponse, "If the operation is successful, the response should not be null."); #region Verify GetItem operation requirements this.VerifySoapVersion(); this.VerifyTransportType(); this.VerifyGetContactItem(getItemResponse, this.exchangeServiceBinding.IsSchemaValidated); #endregion return(getItemResponse); }
bool IsActiveNew(BaseDragChild dragChild, BaseDragChild centerChild, GetItemType targetMoveType) { bool isActiveNew = false; if (dragChild != null && centerChild != null) { float pos1 = IsHorizontal ? dragChild.mTran.localPosition.x : dragChild.mTran.localPosition.y; float pos2 = IsHorizontal ? centerChild.mTran.localPosition.x : centerChild.mTran.localPosition.y; float distance = Mathf.Abs(Mathf.Abs(pos1) - Mathf.Abs(pos2)); if (distance < TargetActiveItemDis(targetMoveType)) { isActiveNew = true; } } return(isActiveNew); }
/// <summary> /// Get the calendar related item elements. /// </summary> /// <param name="request">A request to the GetItem operation.</param> /// <returns>The response message returned by GetItem operation.</returns> public GetItemResponseType GetItem(GetItemType request) { if (request == null) { throw new ArgumentException("The request of operation 'GetItem' should not be null."); } GetItemResponseType getItemResponse = this.exchangeServiceBinding.GetItem(request); Site.Assert.IsNotNull(getItemResponse, "If the operation is successful, the response should not be null."); this.VerifySoapVersion(); this.VerifyTransportType(); this.VerifyGetItemOperation(getItemResponse, this.exchangeServiceBinding.IsSchemaValidated); return(getItemResponse); }
/// <summary> /// Get items on the server. /// </summary> /// <param name="getItemRequest">Specify a request to get items on the server.</param> /// <returns>A response to GetItem operation request.</returns> public GetItemResponseType GetItem(GetItemType getItemRequest) { GetItemResponseType response = this.exchangeServiceBinding.GetItem(getItemRequest); Site.Assert.IsNotNull(response, "If the operation is successful, the response should not be null."); // SOAP version is set to 1.1, if a response can be received from server, then it means SOAP 1.1 is supported. this.VerifySoapVersion(); // Verify transport type related requirement. this.VerifyTransportType(); this.VerifyServerVersionInfo(this.exchangeServiceBinding.ServerVersionInfoValue, this.exchangeServiceBinding.IsSchemaValidated); this.VerifyGetItemResponse(response, this.exchangeServiceBinding.IsSchemaValidated); this.VerifyItemId(response); return(response); }
/// <summary> /// Define general GetItem request message /// </summary> /// <param name="itemId">The item identifier of the item.</param> /// <param name="baseShape">The basic configuration of properties to be returned in an item response.</param> /// <returns>A request to get an item from a mailbox</returns> protected GetItemType DefineGeneralGetItemRequestMessage(ItemIdType itemId, DefaultShapeNamesType baseShape) { GetItemType getItemRequest = new GetItemType { ItemIds = new ItemIdType[] { itemId }, ItemShape = new ItemResponseShapeType { BaseShape = baseShape, } }; return(getItemRequest); }
private CalendarItemType GetOccurrenceItem(Appointment master, int index) { ItemIdType masterItemId = new ItemIdType(); masterItemId.Id = master.Attributes[ExchangeIdAttribute]; masterItemId.ChangeKey = master.Attributes[ExchangeChangeKeyAttribute]; OccurrenceItemIdType occurrenceItemId = new OccurrenceItemIdType(); occurrenceItemId.RecurringMasterId = masterItemId.Id; occurrenceItemId.InstanceIndex = index; PathToUnindexedFieldType calendarItemTypePath = new PathToUnindexedFieldType(); calendarItemTypePath.FieldURI = UnindexedFieldURIType.calendarCalendarItemType; GetItemType getItemRequest = new GetItemType(); getItemRequest.ItemShape = new ItemResponseShapeType(); getItemRequest.ItemShape.BaseShape = DefaultShapeNamesType.IdOnly; getItemRequest.ItemShape.AdditionalProperties = new BasePathToElementType[] { calendarItemTypePath }; getItemRequest.ItemIds = new BaseItemIdType[] { masterItemId, occurrenceItemId }; GetItemResponseType getItemResponse = Service.GetItem(getItemRequest); CalendarItemType occurrenceItem = null; foreach (ItemInfoResponseMessageType getItemResponseMessage in getItemResponse.ResponseMessages.Items) { if (getItemResponseMessage.ResponseClass == ResponseClassType.Success && getItemResponseMessage.Items.Items != null && getItemResponseMessage.Items.Items.Length > 0) { occurrenceItem = (CalendarItemType)getItemResponseMessage.Items.Items[0]; } } if (occurrenceItem == null) { throw new Exception("Unable to find occurrence"); } return(occurrenceItem); }
void OnMoveItem(GetItemType getType) { if (mDisableDragChildGroup.Count == 0) { return; } var showIndex = GetNextShowItemIndex(getType); bool isUp = getType == GetItemType.Up || getType == GetItemType.Left; for (int i = 0; i < showIndex.Count; i++) { var child = GetBaseDragChildByDisableGroup();// mDisableDragChildGroup.Dequeue(); SetItemShowEnable(child.transform, true); float newPosY = transform.localPosition.y + (isUp ? mPosYCount * mPosHeight : -mPosYCount * mPosHeight); child.transform.localPosition = new Vector3(i * mPosWidth, newPosY); SetItemPos(child, showIndex[i]); child.Init(mDataDic[showIndex[i]]); child.mDataIndex = showIndex[i]; mActiveDragChildGroup.Add(child); } }
/// <summary> /// Get the items information. /// </summary> /// <param name="itemIds">The array of item ids.</param> /// <returns>The items information.</returns> protected ItemType[] GetItems(BaseItemIdType[] itemIds) { GetItemType getItem = new GetItemType(); if (itemIds != null) { getItem.ItemIds = itemIds; getItem.ItemShape = new ItemResponseShapeType(); getItem.ItemShape.BaseShape = DefaultShapeNamesType.AllProperties; } // Call GetItem operation GetItemResponseType getItemResponse = this.COREAdapter.GetItem(getItem); // Check whether the GetItem operation is executed successfully. foreach (ResponseMessageType responseMessage in getItemResponse.ResponseMessages.Items) { Site.Assert.AreEqual <ResponseClassType>( ResponseClassType.Success, responseMessage.ResponseClass, string.Format( "Get items should not be failed! Expected response code: {0}, actual response code: {1}", ResponseCodeType.NoError, responseMessage.ResponseCode)); } // If the operation executes successfully, the items in getItem response should be equal to the value of ItemCount. Site.Assert.AreEqual <int>( getItemResponse.ResponseMessages.Items.Length, this.ItemCount, string.Format( "The getItem response should contain {0} items, actually it contains {1}", this.ItemCount, getItemResponse.ResponseMessages.Items.Length)); // Get the items from successful response. ItemType[] getItems = Common.GetItemsFromInfoResponse <ItemType>(getItemResponse); return(getItems); }
/// <remarks/> public void GetItemAsync(GetItemType GetItem1) { this.GetItemAsync(GetItem1, null); }
/// <remarks/> public System.IAsyncResult BeginGetItem(GetItemType GetItem1, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("GetItem", new object[] { GetItem1}, callback, asyncState); }
private ItemInfoResponseMessageType[] GetItem(GetItemType request) { return this.ExecuteWebMethodMultiResponse<ItemInfoResponseMessageType>(() => this.binding.GetItem(request)); }
public void MSOXWSMSG_S02_TC01_UpdateMessage() { #region Create message CreateItemType createItemRequest = GetCreateItemType(MessageDispositionType.SaveOnly, DistinguishedFolderIdNameType.drafts); CreateItemResponseType createItemResponse = this.MSGAdapter.CreateItem(createItemRequest); Site.Assert.IsTrue(this.VerifyCreateItemResponse(createItemResponse, MessageDispositionType.SaveOnly), @"Server should return success for creating the email messages."); this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(createItemResponse); this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0); // Save the ItemId of message responseMessageItem returned from the createItem response. ItemIdType itemIdType = new ItemIdType(); Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem.ItemId, @"The ItemId property of the first item should not be null."); itemIdType.Id = this.firstItemOfFirstInfoItem.ItemId.Id; itemIdType.ChangeKey = this.firstItemOfFirstInfoItem.ItemId.ChangeKey; #endregion #region update ToRecipients property of the original message UpdateItemType updateItemRequest = new UpdateItemType { MessageDisposition = MessageDispositionType.SaveOnly, MessageDispositionSpecified = true, ItemChanges = new ItemChangeType[] { new ItemChangeType { Item = itemIdType, Updates = new ItemChangeDescriptionType[] { new SetItemFieldType { Item = new PathToUnindexedFieldType { FieldURI = UnindexedFieldURIType.messageToRecipients }, // Update the ToRecipients of message from Recipient1 to Recipient2. Item1 = new MessageType { ToRecipients = new EmailAddressType[] { new EmailAddressType { EmailAddress = this.Recipient2 } } } } } } } }; UpdateItemResponseType updateItemResponse = this.MSGAdapter.UpdateItem(updateItemRequest); Site.Assert.IsTrue(this.VerifyResponse(updateItemResponse), @"Server should return success for creating the email messages."); this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(createItemResponse); this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0); Site.Assert.IsNotNull(this.infoItems, @"InfoItems in the returned response should not be null."); Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem, @"The first item of the array of ItemType type returned from server response should not be null."); // Save the ItemId of message responseMessageItem got from the UpdateItem response. if (this.firstItemOfFirstInfoItem != null) { Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem.ItemId, @"The ItemId property of the first item should not be null."); itemIdType.Id = this.firstItemOfFirstInfoItem.ItemId.Id; itemIdType.ChangeKey = this.firstItemOfFirstInfoItem.ItemId.ChangeKey; } #region Verify the requirements about UpdateItem // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R143"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R143 Site.CaptureRequirementIfIsNotNull( updateItemResponse, 143, @"[In UpdateItem] The protocol client sends an UpdateItemSoapIn request WSDL message, and the protocol server responds with an UpdateItemSoapOut response WSDL message."); Site.Assert.IsNotNull(this.infoItems[0].ResponseClass, @"The ResponseClass property of the first item of infoItems instance should not be null."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R144"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R144 Site.CaptureRequirementIfAreEqual <ResponseClassType>( ResponseClassType.Success, this.infoItems[0].ResponseClass, 144, @"[In UpdateItem] If the UpdateItem WSDL operation request is successful, the server returns an UpdateItemResponse element, as specified in [MS-OXWSCORE] section 3.1.4.9.2.2, with the ResponseClass attribute, as specified in [MS-OXWSCDATA] section 2.2.4.67, of the UpdateItemResponseMessage element, as specified in [MS-OXWSCDATA] section 2.2.4.12, set to ""Success"". "); Site.Assert.IsNotNull(this.infoItems[0].ResponseCode, @"The ResponseCode property of the first item of infoItems instance should not be null."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R145"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R145 Site.CaptureRequirementIfAreEqual <ResponseCodeType>( ResponseCodeType.NoError, this.infoItems[0].ResponseCode, 145, @"[In UpdateItem] [A successful UpdateItem operation request returns an UpdateItemResponse element] The ResponseCode element, as specified in [MS-OXWSCDATA] section 2.2.4.67, of the UpdateItemResponseMessage element is set to ""NoError"". "); #endregion #endregion #region Get the updated message GetItemType getItemRequest = DefineGeneralGetItemRequestMessage(itemIdType, DefaultShapeNamesType.AllProperties); GetItemResponseType getItemResponse = this.MSGAdapter.GetItem(getItemRequest); Site.Assert.IsTrue(this.VerifyResponse(getItemResponse), @"Server should return success for getting the email messages."); this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(getItemResponse); Site.Assert.IsNotNull(this.infoItems, @"The GetItem response should contain one or more items of ItemInfoResponseMessageType."); ItemType updatedItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0); Site.Assert.IsNotNull(updatedItem, @"The updated message should exist"); string expectedValue = Common.GetConfigurationPropertyValue("Recipient2", this.Site); Site.Assert.AreEqual <string>( expectedValue.ToLower(), updatedItem.DisplayTo.ToLower(), string.Format("The expected value of the DisplayTo property is {0}. The actual value is {1}.", expectedValue, updatedItem.DisplayTo)); #endregion #region Clean up Sender's drafts folder bool isClear = this.MSGSUTControlAdapter.CleanupFolders( Common.GetConfigurationPropertyValue("Sender", this.Site), Common.GetConfigurationPropertyValue("SenderPassword", this.Site), this.Domain, this.Subject, "drafts"); Site.Assert.IsTrue(isClear, "Sender's drafts folder should be cleaned up."); #endregion }
/// <summary> /// Get item on the server. /// </summary> /// <param name="getItemRequest">Get item operation request type.</param> /// <returns>Get item operation response type.</returns> public GetItemResponseType GetItem(GetItemType getItemRequest) { GetItemResponseType gitItemResponse = this.exchangeServiceBinding.GetItem(getItemRequest); return(gitItemResponse); }
private ItemType[] InternalFindItems(FindItemType findItemType, ItemResponseShapeType itemShape) { if (itemShape == null) { itemShape = EwsAuditClient.DefaultItemShape; } List <ItemType> items = null; IEnumerable <BaseItemIdType> enumerable = this.InternalFindItemIds(findItemType); using (IEnumerator <BaseItemIdType> enumerator = enumerable.GetEnumerator()) { List <BaseItemIdType> list = new List <BaseItemIdType>(64); bool flag; do { flag = enumerator.MoveNext(); if (flag) { list.Add(enumerator.Current); } if (list.Count == 64 || (list.Count > 0 && !flag)) { GetItemType getItemType = new GetItemType { ItemShape = itemShape, ItemIds = list.ToArray() }; this.CallEwsWithRetries((LID)41148U, () => this.binding.GetItem(getItemType), delegate(ResponseMessageType responseMessage, int messageIndex) { ItemInfoResponseMessageType itemInfoResponseMessageType = responseMessage as ItemInfoResponseMessageType; if (itemInfoResponseMessageType != null && itemInfoResponseMessageType.ResponseClass == ResponseClassType.Success && itemInfoResponseMessageType.Items != null) { ItemType[] items = itemInfoResponseMessageType.Items.Items; foreach (ItemType item in items) { if (items == null) { items = new List <ItemType>(); } items.Add(item); } return(false); } return(false); }, delegate(ResponseMessageType responseMessage, int messageIndex) { if (responseMessage != null && responseMessage.ResponseClass == ResponseClassType.Error) { ResponseCodeType responseCode = responseMessage.ResponseCode; if (responseCode == ResponseCodeType.ErrorItemNotFound || responseCode == ResponseCodeType.ErrorMessageSizeExceeded) { return(true); } } return(false); }); list.Clear(); } }while (flag); } if (items != null && items.Count > 0) { return(items.ToArray()); } return(Array <ItemType> .Empty); }
public void MSOXWSMSG_S06_TC01_OperateMultipleMessages() { #region Create multiple message string subject = Common.GenerateResourceName(this.Site, Common.GetConfigurationPropertyValue("Subject", Site), 0); string anotherSubject = Common.GenerateResourceName(this.Site, Common.GetConfigurationPropertyValue("Subject", Site), 1); CreateItemType createItemRequest = new CreateItemType { MessageDisposition = MessageDispositionType.SaveOnly, // MessageDispositionSpecified value needs to be set. MessageDispositionSpecified = true, SavedItemFolderId = new TargetFolderIdType { Item = new DistinguishedFolderIdType { Id = DistinguishedFolderIdNameType.drafts } }, Items = new NonEmptyArrayOfAllItemsType { // Create an responseMessageItem with two MessageType instances. Items = new MessageType[] { new MessageType { Sender = new SingleRecipientType { Item = new EmailAddressType { EmailAddress = this.Sender } }, ToRecipients = new EmailAddressType[] { new EmailAddressType { EmailAddress = this.Recipient1 } }, Subject = subject, }, new MessageType { Sender = new SingleRecipientType { Item = new EmailAddressType { EmailAddress = this.Sender } }, ToRecipients = new EmailAddressType[] { new EmailAddressType { EmailAddress = this.Recipient2 } }, Subject = anotherSubject, } } }, }; CreateItemResponseType createItemResponse = this.MSGAdapter.CreateItem(createItemRequest); Site.Assert.IsTrue(this.VerifyMultipleResponse(createItemResponse), @"Server should return success for creating the email messages."); this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(createItemResponse); this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0); Site.Assert.IsNotNull(this.infoItems, @"InfoItems in the returned response should not be null."); Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem, @"The first item of the array of ItemType type returned from server response should not be null."); // Save the first ItemId of message responseMessageItem got from the createItem response. Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem.ItemId, @"The ItemId property of the first item should not be null."); ItemIdType itemIdType1 = new ItemIdType(); itemIdType1.Id = this.firstItemOfFirstInfoItem.ItemId.Id; itemIdType1.ChangeKey = this.firstItemOfFirstInfoItem.ItemId.ChangeKey; // Save the second ItemId. this.firstItemOfSecondInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 1, 0); Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem, @"The second item of the array of ItemType type returned from server response should not be null."); Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem.ItemId, @"The ItemId property of the second item should not be null."); ItemIdType itemIdType2 = new ItemIdType(); itemIdType2.Id = this.firstItemOfSecondInfoItem.ItemId.Id; itemIdType2.ChangeKey = this.firstItemOfSecondInfoItem.ItemId.ChangeKey; #endregion #region Get the multiple messages which created GetItemType getItemRequest = new GetItemType { // Set the two ItemIds got from CreateItem response. ItemIds = new ItemIdType[] { itemIdType1, itemIdType2 }, ItemShape = new ItemResponseShapeType { BaseShape = DefaultShapeNamesType.AllProperties, } }; GetItemResponseType getItemResponse = this.MSGAdapter.GetItem(getItemRequest); Site.Assert.IsTrue(this.VerifyMultipleResponse(getItemResponse), @"Server should return success for creating the email messages."); #endregion #region Update the multiple messages which created UpdateItemType updateItemRequest = new UpdateItemType { MessageDisposition = MessageDispositionType.SaveOnly, // MessageDispositionSpecified value needs to be set. MessageDispositionSpecified = true, // Create two ItemChangeType instances. ItemChanges = new ItemChangeType[] { new ItemChangeType { Item = itemIdType1, Updates = new ItemChangeDescriptionType[] { new SetItemFieldType { Item = new PathToUnindexedFieldType { FieldURI = UnindexedFieldURIType.messageToRecipients }, // Update ToRecipients property of the first message. Item1 = new MessageType { ToRecipients = new EmailAddressType[] { new EmailAddressType { EmailAddress = this.Recipient2 } } } }, } }, new ItemChangeType { Item = itemIdType2, Updates = new ItemChangeDescriptionType[] { new SetItemFieldType { Item = new PathToUnindexedFieldType { FieldURI = UnindexedFieldURIType.messageToRecipients }, // Update ToRecipients property of the second message. Item1 = new MessageType { ToRecipients = new EmailAddressType[] { new EmailAddressType { EmailAddress = this.Recipient1 } } } }, } } } }; UpdateItemResponseType updateItemResponse = this.MSGAdapter.UpdateItem(updateItemRequest); Site.Assert.IsTrue(this.VerifyMultipleResponse(updateItemResponse), @"Server should return success for updating the email messages."); this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(updateItemResponse); this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0); Site.Assert.IsNotNull(this.infoItems, @"InfoItems in the returned response should not be null."); Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem, @"The first item of the array of ItemType type returned from server response should not be null."); // Save the ItemId of the first message responseMessageItem got from the UpdateItem response. Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem.ItemId, @"The ItemId property of the first item should not be null."); itemIdType1.Id = this.firstItemOfFirstInfoItem.ItemId.Id; itemIdType1.ChangeKey = this.firstItemOfFirstInfoItem.ItemId.ChangeKey; // Save the ItemId of the second message responseMessageItem got from the UpdateItem response. this.firstItemOfSecondInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 1, 0); Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem, @"The second item of the array of ItemType type returned from server response should not be null."); Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem.ItemId, @"The ItemId property of the second item should not be null."); itemIdType2.Id = this.firstItemOfSecondInfoItem.ItemId.Id; itemIdType2.ChangeKey = this.firstItemOfSecondInfoItem.ItemId.ChangeKey; #endregion #region Copy the updated multiple message to junkemail CopyItemType copyItemRequest = new CopyItemType { ItemIds = new ItemIdType[] { itemIdType1, itemIdType2, }, // Copy the message to junk email folder. ToFolderId = new TargetFolderIdType { Item = new DistinguishedFolderIdType { Id = DistinguishedFolderIdNameType.junkemail } } }; CopyItemResponseType copyItemResponse = this.MSGAdapter.CopyItem(copyItemRequest); Site.Assert.IsTrue(this.VerifyMultipleResponse(copyItemResponse), @"Server should return success for copying the email messages."); this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(copyItemResponse); this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0); Site.Assert.IsNotNull(this.infoItems, @"InfoItems in the returned response should not be null."); Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem, @"The first item of the array of ItemType type returned from server response should not be null."); // Save the ItemId of the first message responseMessageItem got from the CopyItem response. Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem.ItemId, @"The ItemId property of the first item should not be null."); ItemIdType copyItemIdType1 = new ItemIdType(); copyItemIdType1.Id = this.firstItemOfFirstInfoItem.ItemId.Id; copyItemIdType1.ChangeKey = this.firstItemOfFirstInfoItem.ItemId.ChangeKey; // Save the ItemId of the second message responseMessageItem got from the CopyItem response. this.firstItemOfSecondInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 1, 0); Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem, @"The second item of the array of ItemType type returned from server response should not be null."); Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem.ItemId, @"The ItemId property of the second item should not be null."); ItemIdType copyItemIdType2 = new ItemIdType(); copyItemIdType2.Id = this.firstItemOfSecondInfoItem.ItemId.Id; copyItemIdType2.ChangeKey = this.firstItemOfSecondInfoItem.ItemId.ChangeKey; #endregion #region Move the copied multiple message from junkemail to deleteditems MoveItemType moveItemRequest = new MoveItemType { // Set to copied message responseMessageItem id. ItemIds = new ItemIdType[] { copyItemIdType1, copyItemIdType2 }, // Move the copied messages to deleted items folder. ToFolderId = new TargetFolderIdType { Item = new DistinguishedFolderIdType { Id = DistinguishedFolderIdNameType.deleteditems } } }; MoveItemResponseType moveItemResponse = this.MSGAdapter.MoveItem(moveItemRequest); Site.Assert.IsTrue(this.VerifyMultipleResponse(moveItemResponse), @"Server should return success for moving the email messages."); this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(moveItemResponse); this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0); Site.Assert.IsNotNull(this.infoItems, @"InfoItems in the returned response should not be null."); Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem, @"The first item of the array of ItemType type returned from server response should not be null."); // Save the ItemId of the first message responseMessageItem got from the MoveItem response. Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem.ItemId, @"The ItemId property of the first item should not be null."); copyItemIdType1.Id = this.firstItemOfFirstInfoItem.ItemId.Id; copyItemIdType1.ChangeKey = this.firstItemOfFirstInfoItem.ItemId.ChangeKey; // Save the ItemId of the second message responseMessageItem got from the MoveItem response. this.firstItemOfSecondInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 1, 0); Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem, @"The second item of the array of ItemType type returned from server response should not be null."); Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem.ItemId, @"The ItemId property of the second item should not be null."); copyItemIdType2.Id = this.firstItemOfSecondInfoItem.ItemId.Id; copyItemIdType2.ChangeKey = this.firstItemOfSecondInfoItem.ItemId.ChangeKey; #endregion #region Send multiple messages SendItemType sendItemRequest = new SendItemType { // Set to the two updated messages' ItemIds. ItemIds = new ItemIdType[] { itemIdType1, itemIdType2 }, // Do not save copy. SaveItemToFolder = false, }; SendItemResponseType sendItemResponse = this.MSGAdapter.SendItem(sendItemRequest); Site.Assert.IsTrue(this.VerifyMultipleResponse(sendItemResponse), @"Server should return success for sending the email messages."); #endregion #region Delete the copied messages DeleteItemType deleteItemRequest = new DeleteItemType { // Set to the two copied messages' ItemIds. ItemIds = new ItemIdType[] { copyItemIdType1, copyItemIdType2 } }; DeleteItemResponseType deleteItemResponse = this.MSGAdapter.DeleteItem(deleteItemRequest); Site.Assert.IsTrue(this.VerifyMultipleResponse(deleteItemResponse), @"Server should return success for deleting the email messages."); #endregion #region Clean up Recipient1's and Recipient2's inbox folders bool isClear = this.MSGSUTControlAdapter.CleanupFolders( Common.GetConfigurationPropertyValue("Recipient2", this.Site), Common.GetConfigurationPropertyValue("Recipient2Password", this.Site), this.Domain, subject, "inbox"); Site.Assert.IsTrue(isClear, "Recipient2's inbox folder should be cleaned up."); isClear = this.MSGSUTControlAdapter.CleanupFolders( Common.GetConfigurationPropertyValue("Recipient1", this.Site), Common.GetConfigurationPropertyValue("Recipient1Password", this.Site), this.Domain, anotherSubject, "inbox"); Site.Assert.IsTrue(isClear, "Recipient1's inbox folder should be cleaned up."); #endregion }
private ItemType[] GetRemoteCalendarItems(List <SearchExpressionType> searchItems) { FindItemType findItemType = new FindItemType(); findItemType.ItemShape = CalendarItemFields.CalendarQueryShape; findItemType.ParentFolderIds = new BaseFolderIdType[] { new DistinguishedFolderIdType { Id = DistinguishedFolderIdNameType.calendar } }; findItemType.Restriction = new RestrictionType { Item = new OrType { Items = searchItems.ToArray() } }; FindItemResponseType response = this.binding.FindItem(findItemType); ItemType[] array = this.HandleFindItemResponse(response); if (array == null) { Globals.ConsistencyChecksTracer.TraceDebug((long)this.GetHashCode(), "FindItem returned NULL ArrayOfRealItemsType."); return(null); } List <ItemIdType> list = new List <ItemIdType>(); foreach (ItemType itemType in array) { if (itemType is CalendarItemType) { CalendarItemType calendarItemType = itemType as CalendarItemType; if (calendarItemType.CalendarItemType1 == CalendarItemTypeType.Single) { list.Add(itemType.ItemId); } else { OccurrencesRangeType occurrencesRangeType = new OccurrencesRangeType { Start = base.ValidateFrom.UniversalTime, StartSpecified = true, End = base.ValidateUntil.UniversalTime, EndSpecified = true, Count = 100, CountSpecified = true }; RecurringMasterItemIdRangesType item = new RecurringMasterItemIdRangesType { Id = itemType.ItemId.Id, ChangeKey = itemType.ItemId.ChangeKey, Ranges = new OccurrencesRangeType[] { occurrencesRangeType } }; list.Add(item); } } else { Globals.ConsistencyChecksTracer.TraceDebug((long)this.GetHashCode(), "FindItem returned an item which is not a CalendarItemType. Skipping it."); } } if (list.Count < 1) { Globals.ConsistencyChecksTracer.TraceDebug((long)this.GetHashCode(), "FindItem didn't return valid items."); return(null); } GetItemType getItem = new GetItemType { ItemShape = CalendarItemFields.CalendarItemShape, ItemIds = list.ToArray() }; GetItemResponseType item2 = this.binding.GetItem(getItem); ItemType[] array3 = this.HandleGetItemResponse(item2); if (array3 == null) { Globals.ConsistencyChecksTracer.TraceDebug((long)this.GetHashCode(), "GetItem returned NULL ItemType[]."); } return(array3); }
/// <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); }
// Token: 0x06000582 RID: 1410 RVA: 0x0002ACDC File Offset: 0x00028EDC public List <ElcEwsItem> GetItems(IList <ElcEwsItem> items) { GetItemType getItem = new GetItemType(); ItemResponseShapeType itemResponseShapeType = new ItemResponseShapeType(); itemResponseShapeType.BaseShape = DefaultShapeNamesType.Default; getItem.ItemShape = itemResponseShapeType; getItem.ItemIds = (from elcEwsItem in items select new ItemIdType { Id = elcEwsItem.Id }).ToArray <ItemIdType>(); List <ElcEwsItem> getItems = new List <ElcEwsItem>(getItem.ItemIds.Length); this.CallService(() => this.ServiceBinding.GetItem(getItem), delegate(ResponseMessageType responseMessage, int messageIndex) { ItemInfoResponseMessageType itemInfoResponseMessageType = (ItemInfoResponseMessageType)responseMessage; ElcEwsItem elcEwsItem = items[messageIndex]; if (itemInfoResponseMessageType.ResponseClass != ResponseClassType.Success) { ElcEwsClient.Tracer.TraceError <ResponseCodeType>(0L, "ElcEwsClient.GetItems: GetItem with error response message. ResponseCode : {0}", itemInfoResponseMessageType.ResponseCode); if (itemInfoResponseMessageType.ResponseCode == ResponseCodeType.ErrorItemNotFound) { getItems.Add(new ElcEwsItem { Id = elcEwsItem.Id, Data = null, Error = new ElcEwsException(ElcEwsErrorType.NotFound), StorageItemData = elcEwsItem.StorageItemData }); } else { getItems.Add(new ElcEwsItem { Id = elcEwsItem.Id, Data = null, Error = new ElcEwsException(ElcEwsErrorType.FailedToGetItem, itemInfoResponseMessageType.ResponseCode.ToString()), StorageItemData = elcEwsItem.StorageItemData }); } } else if (itemInfoResponseMessageType.Items != null && itemInfoResponseMessageType.Items.Items != null && itemInfoResponseMessageType.Items.Items.Length > 0) { getItems.Add(new ElcEwsItem { Id = itemInfoResponseMessageType.Items.Items[0].ItemId.Id, Data = null, Error = null, StorageItemData = elcEwsItem.StorageItemData }); } else { getItems.Add(new ElcEwsItem { Id = elcEwsItem.Id, Data = null, Error = new ElcEwsException(ElcEwsErrorType.NoItemReturned), StorageItemData = elcEwsItem.StorageItemData }); } return(true); }, (Exception exception) => ElcEwsClient.WrapElcEwsException(ElcEwsErrorType.FailedToGetItem, exception)); return(getItems); }
public void MSOXWSCORE_S07_TC17_GetTaskItemWithIconIndexSuccessfully() { Site.Assume.IsTrue(Common.IsRequirementEnabled(1917, this.Site), "Exchange 2007 and Exchange 2010 do not support the IconIndex element."); #region Step 1: Create a recurring task item. // Define the pattern and range of the recurring task item. DailyRecurrencePatternType pattern = new DailyRecurrencePatternType(); pattern.Interval = 1; NumberedRecurrenceRangeType range = new NumberedRecurrenceRangeType(); range.NumberOfOccurrences = 5; range.StartDate = System.DateTime.Now; // Define the TaskType item. TaskType[] items = new TaskType[] { new TaskType() }; items[0].Subject = Common.GenerateResourceName( this.Site, TestSuiteHelper.SubjectForCreateItem); items[0].Recurrence = new TaskRecurrenceType(); items[0].Recurrence.Item = pattern; items[0].Recurrence.Item1 = range; // Call CreateItem operation. CreateItemResponseType createItemResponse = this.CallCreateItemOperation(DistinguishedFolderIdNameType.tasks, items); // Check the operation response. Common.CheckOperationSuccess(createItemResponse, 1, this.Site); BaseItemIdType[] createdTaskItemIds = Common.GetItemIdsFromInfoResponse(createItemResponse); // One created task item should be returned. Site.Assert.AreEqual <int>( 1, createdTaskItemIds.GetLength(0), "One created task item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, createdTaskItemIds.GetLength(0)); #endregion #region Step 2: Get the recurring task item by ItemIdType. GetItemType getItem = new GetItemType(); // Create item and return the item id. getItem.ItemIds = createdTaskItemIds; // Set the item shape's elements. getItem.ItemShape = new ItemResponseShapeType(); getItem.ItemShape.BaseShape = DefaultShapeNamesType.AllProperties; getItem.ItemShape.AdditionalProperties = new PathToUnindexedFieldType[] { new PathToUnindexedFieldType() { FieldURI = UnindexedFieldURIType.itemIconIndex } }; // Call GetItem operation using the created task item ID. GetItemResponseType getItemResponse = this.COREAdapter.GetItem(getItem); // Check the operation response. Common.CheckOperationSuccess(getItemResponse, 1, this.Site); #endregion #region Step 3: Assert the value of IconIndex element is "TaskRecur". TaskType[] taskItems = Common.GetItemsFromInfoResponse <TaskType>(getItemResponse); // One created item should be returned. Site.Assert.AreEqual <int>( 1, taskItems.GetLength(0), "One item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, taskItems.GetLength(0)); Site.Assert.IsTrue(this.IsSchemaValidated, "The schema should be validated."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1917"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1917 this.Site.CaptureRequirementIfAreEqual <IconIndexType>( IconIndexType.TaskRecur, taskItems[0].IconIndex, 1917, @"[In Appendix C: Product Behavior] Implementation does support value ""TaskRecur"" of ""IconIndex"" simple type which specifies the recurring task icon. (Exchange 2013 and above follow this behavior.)"); #endregion }
private static void Process(string username, string password, string folderName) { Console.WriteLine(" > Opening file..."); var path = Directory.GetCurrentDirectory() + @"\Leebl.csv"; var leads = new LeadCollection(path); var binding = new ExchangeServiceBinding { Url = "https://amxprd0510.outlook.com/ews/exchange.asmx", Credentials = new NetworkCredential(username, password), RequestServerVersionValue = new RequestServerVersion { Version = ExchangeVersionType.Exchange2010 } }; #region Get folder Console.WriteLine(" > Retrieving folder..."); var folderRequest = new FindFolderType { Traversal = FolderQueryTraversalType.Deep, FolderShape = new FolderResponseShapeType { BaseShape = DefaultShapeNamesType.IdOnly }, ParentFolderIds = new BaseFolderIdType[] { new DistinguishedFolderIdType { Id = DistinguishedFolderIdNameType.root } }, Restriction = new RestrictionType { Item = new ContainsExpressionType { ContainmentMode = ContainmentModeType.Substring, ContainmentModeSpecified = true, ContainmentComparison = ContainmentComparisonType.IgnoreCase, ContainmentComparisonSpecified = true, Item = new PathToUnindexedFieldType { FieldURI = UnindexedFieldURIType.folderDisplayName }, Constant = new ConstantValueType { Value = folderName } } } }; var folderResponse = binding.FindFolder(folderRequest); var folderIds = new List <BaseFolderIdType>(); foreach (var folder in folderResponse.ResponseMessages.Items .Select(x => (x as FindFolderResponseMessageType)) .Where(x => x != null)) { folderIds.AddRange(folder.RootFolder.Folders.Select(y => y.FolderId)); } #endregion #region Get items Console.WriteLine(" > Retrieving items..."); var itemRequest = new FindItemType { Traversal = ItemQueryTraversalType.Shallow, ItemShape = new ItemResponseShapeType { BaseShape = DefaultShapeNamesType.Default }, ParentFolderIds = folderIds.ToArray() }; var itemResponse = binding.FindItem(itemRequest); var itemIds = new List <BaseItemIdType>(); foreach (var item in itemResponse.ResponseMessages.Items .Select(x => (x as FindItemResponseMessageType)) .Where(x => x != null) .Where(x => x.RootFolder != null && x.RootFolder.TotalItemsInView > 0)) { itemIds.AddRange(((ArrayOfRealItemsType)item.RootFolder.Item).Items.Select(y => y.ItemId)); } #endregion #region Get bodies Console.WriteLine(" > Parsing " + itemIds.Count + " messages..."); var messageRequest = new GetItemType { ItemShape = new ItemResponseShapeType { BaseShape = DefaultShapeNamesType.AllProperties }, ItemIds = itemIds.ToArray() }; var messageResponse = binding.GetItem(messageRequest); foreach (var message in messageResponse.ResponseMessages.Items .Select(x => (x as ItemInfoResponseMessageType)) .Where(x => x != null) .Select(x => x.Items.Items[0]) .Where(x => x != null)) { leads.Add(message.Body.Value, message.DateTimeSent); } #endregion Console.WriteLine(" > Saving to file..."); leads.Save(path); }