private void RemoveTestTeamMembers()
        {
            if ((membersToRemove?.Count ?? 0) < 1)
            {
                return;
            }

            var route4Me = new Route4MeManagerV5(ActualApiKey);

            foreach (var member in membersToRemove)
            {
                var memberParams = new MemberQueryParameters()
                {
                    UserId = member.MemberId.ToString()
                };

                var removedMember = route4Me.RemoveTeamMember(memberParams,
                                                              out ResultResponse resultResponse);

                Console.WriteLine(
                    (removedMember?.MemberEmail?.Contains(".deleted") ?? false)
                    ? String.Format("A test member {0} removed succsessfully", removedMember.MemberId)
                    : String.Format("Cannot remove a test member {0}", removedMember.MemberId)
                    );
            }
        }
Example #2
0
        // The example refers to the process of removing a team member from a user account.
        public void RemoveTeamMember()
        {
            // Create the manager with the api key
            var route4Me = new Route4MeManagerV5(ActualApiKey);

            #region Create Member To Remove

            membersToRemove = new List <TeamResponse>();
            CreateTestTeamMember();

            if (membersToRemove.Count < 1)
            {
                Console.WriteLine("Cannot create a team member to remove");
                return;
            }

            var member = membersToRemove[membersToRemove.Count - 1];

            #endregion

            var memberParams = new MemberQueryParameters()
            {
                UserId = member.MemberId.ToString()
            };

            // Run the query
            var removedMember = route4Me.RemoveTeamMember(memberParams,
                                                          out ResultResponse resultResponse);

            PrintTeamMembers(removedMember, resultResponse);

            Console.WriteLine(
                (removedMember?.MemberEmail?.Contains(".deleted") ?? false)
                ? String.Format("A member {0} removed succsessfully", removedMember.MemberId)
                : String.Format("Cannot remove a member {0}", removedMember.MemberId)
                );
        }