コード例 #1
0
        public AtomEntry createWebPage(String title, String html, String pageName)
        {
            SiteEntry    entry    = new SiteEntry();
            AtomCategory category = new AtomCategory(SitesService.WEBPAGE_TERM, SitesService.KIND_SCHEME);

            category.Label = "webpage";
            entry.Categories.Add(category);
            entry.Title.Text      = title;
            entry.Content.Type    = "xhtml";
            entry.Content.Content = html;
            entry.ExtensionElements.Add(makePageNameExtension(pageName));

            AtomEntry newEntry = null;

            try
            {
                newEntry = service.Insert(new Uri(makeFeedUri("content")), entry);
            }
            catch (GDataRequestException e)
            {
                Console.WriteLine(e.ResponseString);
            }

            return(newEntry);
        }
コード例 #2
0
        public AtomEntry updloadAttachment(String filename, String contentType, AtomEntry parent, String title, String description)
        {
            SiteEntry entry = new SiteEntry();

            AtomCategory category = new AtomCategory(SitesService.ATTACHMENT_TERM, SitesService.KIND_SCHEME);

            category.Label = "attachment";
            entry.Categories.Add(category);

            AtomLink parentLink = new AtomLink(AtomLink.ATOM_TYPE, SitesService.PARENT_REL);

            parentLink.HRef = parent.SelfUri;
            entry.Links.Add(parentLink);

            entry.MediaSource  = new MediaFileSource(filename, contentType);
            entry.Content.Type = contentType;

            if (title == "")
            {
                entry.Title.Text = entry.MediaSource.Name;
            }
            else
            {
                entry.Title.Text = title;
            }

            entry.Summary.Text = description;

            AtomEntry newEntry = null;

            try
            {
                newEntry = service.Insert(new Uri(makeFeedUri("content")), entry);
            }
            catch (GDataRequestException e)
            {
                Console.WriteLine(e.ResponseString);
            }

            return(newEntry);
        }
コード例 #3
0
        public AtomEntry createWebPage(String title, String html, String pageName)
        {
            SiteEntry entry = new SiteEntry();
            AtomCategory category = new AtomCategory(SitesService.WEBPAGE_TERM, SitesService.KIND_SCHEME);
            category.Label = "webpage";
            entry.Categories.Add(category);
            entry.Title.Text = title;
            entry.Content.Type = "xhtml";
            entry.Content.Content = html;
            entry.ExtensionElements.Add(makePageNameExtension(pageName));

            AtomEntry newEntry = null;
            try
            {
                newEntry = service.Insert(new Uri(makeFeedUri("content")), entry);
            }
            catch (GDataRequestException e)
            {
                Console.WriteLine(e.ResponseString);
            }

            return newEntry;
        }
コード例 #4
0
        public AtomEntry updloadAttachment(String filename, String contentType, AtomEntry parent, String title, String description)
        {
            SiteEntry entry = new SiteEntry();

            AtomCategory category = new AtomCategory(SitesService.ATTACHMENT_TERM, SitesService.KIND_SCHEME);
            category.Label = "attachment";
            entry.Categories.Add(category);

            AtomLink parentLink = new AtomLink(AtomLink.ATOM_TYPE, SitesService.PARENT_REL);
            parentLink.HRef = parent.SelfUri;
            entry.Links.Add(parentLink);

            entry.MediaSource = new MediaFileSource(filename, contentType);
            entry.Content.Type = contentType;

            if (title == "")
            {
                entry.Title.Text = entry.MediaSource.Name;
            }
            else
            {
                entry.Title.Text = title;
            }

            entry.Summary.Text = description;

            AtomEntry newEntry = null;
            try
            {
                newEntry = service.Insert(new Uri(makeFeedUri("content")), entry);
            }
            catch (GDataRequestException e)
            {
                Console.WriteLine(e.ResponseString);
            }

            return newEntry;
        }