/// <summary> /// Creates an IsEqualTo clause for our search key (Listing 5-14 cont'd) /// </summary> /// <param name="searchKeyPath">Search key path</param> /// <param name="value">base64 search key to look for</param> /// <returns>IsEqualTo clause</returns> /// public static IsEqualToType CreateIsEqualToSearchKey( PathToExtendedFieldType searchKeyPath, string value) { IsEqualToType isEqualTo = new IsEqualToType(); isEqualTo.Item = searchKeyPath; isEqualTo.FieldURIOrConstant = new FieldURIOrConstantType(); ConstantValueType constant = new ConstantValueType(); constant.Value = value; isEqualTo.FieldURIOrConstant.Item = constant; return isEqualTo; }
/// <summary> /// A new, improved ContactsView method (Listing 6-16) /// </summary> /// <param name="folderId">Folder to perform FindItem in</param> /// <param name="responseShape">ResponseShape for returned contacts</param> /// <param name="pathForRestriction">The property path to compare against</param> /// <param name="lowerBounds">lower bounds string (inclusive)</param> /// <param name="upperBounds">upper bounds string (exclusive)</param> /// <param name="offset">For indexed paging, the offset into the result set to start at</param> /// <param name="maxEntries">Max entries to return for each page. Zero for unbounded</param> /// <returns>FindItemResponseMessageType</returns> /// public FindItemResponseMessageType SuperContactsView( BaseFolderIdType folderId, ItemResponseShapeType responseShape, BasePathToElementType pathForRestriction, string lowerBounds, string upperBounds, int offset, int maxEntries) { FindItemType request = new FindItemType(); request.ItemShape = responseShape; // If they set a maxEntries > 0, use indexed paging just to limit the results. // if (maxEntries > 0) { IndexedPageViewType paging = new IndexedPageViewType(); paging.BasePoint = IndexBasePointType.Beginning; paging.Offset = offset; paging.MaxEntriesReturned = maxEntries; paging.MaxEntriesReturnedSpecified = true; request.Item = paging; } request.ParentFolderIds = new BaseFolderIdType[] { folderId }; request.Traversal = ItemQueryTraversalType.Shallow; // Build up our restriction // AndType and = new AndType(); IsGreaterThanOrEqualToType lowerBoundsFilter = new IsGreaterThanOrEqualToType(); lowerBoundsFilter.Item = pathForRestriction; lowerBoundsFilter.FieldURIOrConstant = new FieldURIOrConstantType(); ConstantValueType lowerBoundsValue = new ConstantValueType(); lowerBoundsValue.Value = lowerBounds; lowerBoundsFilter.FieldURIOrConstant.Item = lowerBoundsValue; IsLessThanType upperBoundsFilter = new IsLessThanType(); upperBoundsFilter.Item = pathForRestriction; upperBoundsFilter.FieldURIOrConstant = new FieldURIOrConstantType(); ConstantValueType upperBoundsValue = new ConstantValueType(); upperBoundsValue.Value = upperBounds; upperBoundsFilter.FieldURIOrConstant.Item = upperBoundsValue; and.Items = new SearchExpressionType[] { lowerBoundsFilter, upperBoundsFilter }; request.Restriction = new RestrictionType(); request.Restriction.Item = and; // Make the request // FindItemResponseType response = this.FindItem(request); return response.ResponseMessages.Items[0] as FindItemResponseMessageType; }