public void UpdateGeolocation()
        {
            WebmasterToolsService service = new WebmasterToolsService(this.ApplicationName);

            service.Credentials = new GDataCredentials(this.userName, this.passWord);

            try
            {
                SitesQuery q  = new SitesQuery();
                SitesFeed  sf = service.Query(q);

                SitesEntry entry   = new SitesEntry();
                string     siteUrl = "http://www.example.dk/";
                entry.Content.Src  = siteUrl;
                entry.Content.Type = "text/plain";
                SitesEntry newEntry = service.Insert(new Uri(SitesQuery.HttpsFeedUrl), entry);

                newEntry.GeoLocation = "US";
                SitesEntry updatedEntry = newEntry.Update();

                Assert.IsTrue(updatedEntry != null);
                Assert.IsTrue(updatedEntry.GeoLocation == "US");
            }
            finally
            {
                Uri deleteUrl = SitesQuery.CreateCustomUri("http://www.example.dk");
                service.Delete(deleteUrl, null);
            }
        }
        public void BasicQuery()
        {
            WebmasterToolsService service = new WebmasterToolsService(this.ApplicationName);

            service.Credentials = new GDataCredentials(this.userName, this.passWord);

            string slug =
                Utilities.EncodeSlugHeader(
                    "https://www.google.com/webmasters/tools/feeds/http%3A%2F%2Fwww%2Eexample%2Ecom%2F/crawlissues/");
            FeedQuery query = new FeedQuery(slug);
            AtomFeed  feed  = service.Query(query);

            Assert.IsNotNull(feed);
        }
        public void QueryKeywords()
        {
            WebmasterToolsService service = new WebmasterToolsService(this.ApplicationName);

            service.Credentials = new GDataCredentials(this.userName, this.passWord);

            KeywordsQuery feedQuery = new KeywordsQuery(KeywordsQuery.CreateCustomUri("http%3A%2F%2Fwww%2Eexample%2Ecom%2F"));
            KeywordsFeed  feed      = service.Query(feedQuery);

            Assert.GreaterOrEqual(feed.Entries.Count, 0);

            foreach (KeywordsEntry entry in feed.Entries)
            {
                Assert.IsNotNull(entry.Id);
            }
        }
        public void QueryMessages()
        {
            WebmasterToolsService service = new WebmasterToolsService(this.ApplicationName);

            service.Credentials = new GDataCredentials(this.userName, this.passWord);

            MessagesQuery feedQuery = new MessagesQuery();
            MessagesFeed  feed      = service.Query(feedQuery);

            Assert.GreaterOrEqual(feed.Entries.Count, 0);

            foreach (MessagesEntry entry in feed.Entries)
            {
                Assert.IsNotNull(entry.Id);
            }
        }
        public void QueryCrawlIssues()
        {
            WebmasterToolsService service = new WebmasterToolsService(this.ApplicationName);

            service.Credentials = new GDataCredentials(this.userName, this.passWord);

            string slug =
                Utilities.EncodeSlugHeader(
                    "https://www.google.com/webmasters/tools/feeds/http%3A%2F%2Fwww%2Eexample%2Ecom%2F/crawlissues/");
            CrawlIssuesQuery feedQuery = new CrawlIssuesQuery(slug);
            CrawlIssuesFeed  feed      = service.Query(feedQuery);

            Assert.GreaterOrEqual(feed.Entries.Count, 0);

            foreach (CrawlIssuesEntry entry in feed.Entries)
            {
                Assert.IsNotNull(entry.Id);
            }
        }
예제 #6
0
        public void DeleteSite()
        {
            WebmasterToolsService service = new WebmasterToolsService(this.ApplicationName);

            service.Credentials = new GDataCredentials(this.userName, this.passWord);

            SitesQuery feedQuery  = new SitesQuery();
            SitesFeed  beforeFeed = service.Query(feedQuery);

            int before = beforeFeed.Entries.Count;

            Uri deleteUrl = SitesQuery.CreateCustomUri("http://www.example.com");

            service.Delete(deleteUrl);

            SitesFeed afterFeed = service.Query(feedQuery);
            int       after     = afterFeed.Entries.Count;

            Assert.Greater(before, after);
        }
        public void InsertSite()
        {
            WebmasterToolsService service = new WebmasterToolsService(this.ApplicationName);

            service.Credentials = new GDataCredentials(this.userName, this.passWord);

            SitesQuery feedQuery  = new SitesQuery();
            SitesFeed  beforeFeed = service.Query(feedQuery);

            int before = beforeFeed.Entries.Count;

            SitesEntry entry   = new SitesEntry();
            string     siteUrl = "http://www.example.com/";

            entry.Content.Src  = siteUrl;
            entry.Content.Type = "text/plain";
            service.Insert(new Uri(SitesQuery.HttpsFeedUrl), entry);

            SitesFeed afterFeed = service.Query(feedQuery);
            int       after     = afterFeed.Entries.Count;

            Assert.Greater(after, before);
        }
예제 #8
0
 public Webmaster()
 {
     service = new WebmasterToolsService("tradelr");
     service.setUserCredentials("*****@*****.**", "tuaki1976");
 }