Exemple #1
0
        static void Main(string[] args)
        {
            bool isLoggedIn = false;

            using (RetsSession retssession = new RetsSession("http://www.eele-rets.com:6160/rets/login"))
            {
                retssession.UseHttpGet(true);
                //retssession.
                isLoggedIn = retssession.Login("corcoran", "JDXzmkGa");

                if (isLoggedIn)
                {
                    var urls = retssession.GetCapabilityUrls();
                    Console.WriteLine(urls.GetLoginUrl());

                    RetsMetadata metadata  = retssession.GetMetadata();
                    IEnumerable  resources = metadata.GetAllResources();

                    using (SearchRequest searchRequest = retssession.CreateSearchRequest(
                               "Property",
                               "CLISTINGS",
                               "(Modified=2016-12-12T00:00:00+)"))
                    {
                        searchRequest.SetQueryType(SearchRequest.QueryType.DMQL2);
                        searchRequest.SetStandardNames(false);
                        searchRequest.SetOffset(SearchRequest.OFFSET_NONE);
                        SearchResultSet results = retssession.Search(searchRequest);
                        Console.WriteLine("Record count: " + results.GetCount());
                        Console.WriteLine();
                        IEnumerable columns = results.GetColumns();
                        while (results.HasNext())
                        {
                            foreach (string column in columns)
                            {
                                Console.WriteLine(column + ": " + results.GetString(column));
                            }
                            Console.WriteLine();
                        }
                    }
                }
            }
        }