예제 #1
0
        /// <summary>
        /// Change a network user's domain
        /// </summary>
        /// <param name="authenticationToken">Encrypted forms auth token identifying the requesting user.</param>
        /// <param name="userName">The user's name.</param>
        /// <param name="oldDomain">The user current domain name.</param>
        /// <param name="newDomain">The user's new domain name.</param>
        private static string ChangeUserDomain(string authenticationToken, string userName, string oldDomain, string newDomain)
        {
            /*
             * 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.ChangeUserDomain(
                authenticationToken,
                userName,
                oldDomain,
                newDomain);

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

            return result.ResultData;
        }