Ejemplo n.º 1
0
        /// <summary>
        /// Get a paged, sorted, and filtered list of user identities.
        /// </summary>
        /// <param name="authenticationToken">Encrypted forms auth token identifying the requesting user.</param>
        /// <param name="pageNumber">The index of the first page to begin retrieving results from. Specifying 0 disables pagination.</param>
        /// <param name="pageSize">The number of results to display on a page. Specifying 0 disables pagination.</param>
        /// <param name="sortField">The field used when sorting results. Specifying null disables sorting..</param>
        /// <param name="sortAscending">The sort direction.</param>
        /// <param name="filterField">The field to use when filtering results. Specifying null disables filtering.</param>
        /// <param name="filterValue">Filter criteria. Specifying null disables filtering.</param>
        /// <returns>List of user identities matching filters (or all identities if filter values are null).</returns>
        private static IEnumerable<string> ListUserIdentities(
                                            string authenticationToken,
                                            int pageNumber = 0,
                                            int pageSize = 0,
                                            string sortField = null,
                                            bool sortAscending = true,
                                            string filterField = null,
                                            string filterValue = null)
        {
            /*
             * If you are unable to reference System.Service make sure that the project is configured to
             * use the full 4.0 framework and not the client profile.
             */
            var proxy = new UserManagementServiceClient();
            var result = proxy.ListUserIdentities(
                                                                                                authenticationToken,
                                                                                                pageNumber,
                                                                                                pageSize,
                                                                                                sortField,
                                                                                                sortAscending,
                                                                                                filterField,
                                                                                                filterValue);

            // Handle exceptions
            if (!result.CallSuccess)
            {
                Console.WriteLine(result.FailureMessage);
                return null;
            }

            return result.ResultData.ResultPage;
        }