BusinessComponents.OperationsComponent.GetContactLists C# (CSharp) Метод

GetContactLists() публичный статический Метод

Gets the contact list collection for the current user
public static GetContactLists ( CredentialsDetails credentialsDetail, string &strRequest, string &strResponse ) : List
credentialsDetail BusinessObjects.CredentialsDetails An object that encapsulates the Constant Contact credentials
strRequest string The request string representation
strResponse string The response string representation
Результат List
        public static List<ContactListDetails> GetContactLists(CredentialsDetails credentialsDetail,
            out string strRequest, out string strResponse)
        {
            var contactURI = "https://api.constantcontact.com/ws/customers/" + credentialsDetail.User + "/lists";

            var xmlResponse = ApiCallComponent.CallServiceGet(credentialsDetail, contactURI, out strRequest,
                                                              out strResponse);

            var xdoc = XDocument.Parse(xmlResponse);

            if (xdoc.Root == null)
            {
                return null;
            }

            var lists = from f in xdoc.Root.Descendants(W3Ns + "entry")
                        let element = f.Element(W3Ns + "id")
                        where element != null
                        let xElement = element
                        where
                            xElement != null &&
                            (!xElement.Value.Contains("do-not-mail") & !xElement.Value.Contains("active") &
                             !xElement.Value.Contains("removed"))
                        let xElement1 = f.Element(W3Ns + "content")
                        where xElement1 != null
                        let element1 = xElement1.Element(ConstantContactNs + "ContactList")
                        where element1 != null
                        let xElement2 = element1.Element(ConstantContactNs + "Name")
                        where xElement2 != null
                        select new
                                   {
                                       id = element.Value,
                                       name = xElement2.Value
                                   };

            return
                lists.Select(
                    list => new ContactListDetails {Id = "https" + Regex.Split(list.id, "http")[1], Name = list.name}).
                    ToList();
        }