Setting publishing_priority attribute in .NET


For items to be published immediately using the Google Base API, you must set the publishing_priority to 'high'. The default is 'low'.

If you're using 1.2.3+ of the .NET client:
GBaseEntry entry = new GBaseEntry();
entry.PublishingPriority = new PublishingPriority("high");
GBaseEntry myEntry = service.Insert(GBaseUriFactory.Default.ItemsFeedUri, entry); 
Older versions:
GBaseEntry entry = new GBaseEntry();

XmlDocument xmlDocument = new XmlDocument();
XmlNode node = xmlDocument.CreateNode(XmlNodeType.Element, 
  "app", "control", "http://purl.org/atom/app#");
XmlNode pp = xmlDocument.CreateNode(XmlNodeType.Element, 
  "gm", "publishing_priority", "http://base.google.com/ns-metadata/1.0");

pp.InnerText = "high";
node.AppendChild(pp);

entry.ExtensionElements.Add(node);
GBaseEntry myEntry = service.Insert(GBaseUriFactory.Default.ItemsFeedUri, entry);

2 comments:

Blog Moderator said...

You can't create an instance of XmlNode because it's abstract.

Jeff Fisher said...

Thanks for the catch! We fixed this, so try it out now. :)