示例#1
0
        /// <summary>
        /// Changes a user's unique identifier
        /// </summary>
        /// <param name="authenticationToken">Encrypted forms auth token identifying the requesting user.</param>
        /// <param name="uniqueIdentifier">The unique identifiers of the users to modify.</param>
        /// <param name="newUniqueIdentifier">The user's new unique identifier.</param>
        /// <returns></returns>
        private static string RenameUser(string authenticationToken, string uniqueIdentifier, string newUniqueIdentifier)
        {
            /*
             * 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.RenameUser(authenticationToken, uniqueIdentifier, newUniqueIdentifier);

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

            return result.ResultData;
        }
        private static bool RenameUser(string authToken, string uniqueIdentifier, string newUniqueIdentifier)
        {
            if (!String.IsNullOrEmpty(newUniqueIdentifier))
            {
                var service = new UserManagementServiceClient();
                var result = service.RenameUser(authToken, uniqueIdentifier, newUniqueIdentifier);

                if (result.CallSuccess) return true;
                Console.WriteLine(result.FailureMessage);
                return false;
            }
            else
            {
                Console.WriteLine("New Username is NULL or Empty");
                return false;
            }
        }