コード例 #1
0
        /// <summary>
        /// Update an address book group
        /// </summary>
        public void UpdateAddressBookGroup()
        {
            var route4Me = new Route4MeManager(ActualApiKey);

            CreateAddressBookGroup();

            string groupId = addressBookGroupsToRemove[addressBookGroupsToRemove.Count - 1];

            var addressBookGroupRule = new AddressBookGroupRule()
            {
                ID       = "address_1",
                Field    = "address_1",
                Operator = "not_equal",
                Value    = "qwerty1234567"
            };

            var addressBookGroupFilter = new AddressBookGroupFilter()
            {
                Condition = "AND",
                Rules     = new AddressBookGroupRule[] { addressBookGroupRule }
            };

            var addressBookGroupParameters = new AddressBookGroup()
            {
                groupID    = groupId,
                groupColor = "cd74e6",
                Filter     = addressBookGroupFilter
            };

            // Run the query
            var addressBookGroup = route4Me
                                   .UpdateAddressBookGroup(addressBookGroupParameters, out string errorString);

            if (addressBookGroup == null && addressBookGroup.GetType() != typeof(AddressBookGroup))
            {
                Console.WriteLine("Cannot update the address book group " + groupId);
            }
            else
            {
                Console.WriteLine(
                    addressBookGroup.groupColor == "cd74e6"
                    ? "Updated the color of the address book group " + groupId
                    : "Cannot update the color of the address book group " + groupId
                    );
            }

            RemoveAddressBookGroups();
        }
コード例 #2
0
        /// <summary>
        /// Add an address book group to the user's account.
        /// </summary>
        public void AddAddressBookGroup()
        {
            var route4Me = new Route4MeManager(ActualApiKey);

            var addressBookGroupRule = new AddressBookGroupRule()
            {
                ID       = "address_1",
                Field    = "address_1",
                Operator = "not_equal",
                Value    = "qwerty123456"
            };

            var addressBookGroupFilter = new AddressBookGroupFilter()
            {
                Condition = "AND",
                Rules     = new AddressBookGroupRule[] { addressBookGroupRule }
            };

            var addressBookGroupParameters = new AddressBookGroup()
            {
                groupName  = "All Group",
                groupColor = "92e1c0",
                Filter     = addressBookGroupFilter
            };

            // Run the query
            var addressBookGroup = route4Me.AddAddressBookGroup(
                addressBookGroupParameters,
                out string errorString);

            if (addressBookGroup == null || addressBookGroup.GetType() != typeof(AddressBookGroup))
            {
                Console.WriteLine(
                    "Cannot create an address book group." +
                    Environment.NewLine +
                    errorString);

                return;
            }
            else
            {
                Console.WriteLine("Created an address book group " + addressBookGroup.groupID);
                AddAddressBookGroupToRemoveList(addressBookGroup.groupID);
            }

            RemoveAddressBookGroups();
        }