Hello Team

I am using below code to insert entry with gbase api in .net.  I am not
getting any error from Gbase yet Product is not being inserted in my entry
list. Please suggest if am doing any mistake.


Thanks
Prashant

Dim objGoogle As New cls_googleSyndication

Dim service As GBaseService = New GBaseService("Insert-OnEcoomerProuducts",
objGoogle.Developerkey)

service.setUserCredentials(objGoogle.Username, objGoogle.Password)

Dim feed As GBaseFeed =
service.Query(NewGBaseQuery(GBaseUriFactory.Default.GetItemTypesFeedUri(
"en_US")))

Dim AmFeed As AtomFeed = New AtomFeed(feed)

AmFeed.BatchData = New GDataBatchFeedData

Dim AtomTitle As AtomTextConstruct =
NewAtomTextConstruct(AtomTextConstructElementType.Title, "Oncommerce
Products")

AmFeed.Title = AtomTitle

Dim AtomId As AtomId = New AtomId("http://www.google.com/base/feeds/items";)

AmFeed.Id = AtomId

Dim AtmLink As AtomLink = New AtomLink

AtmLink.Type = AtomLink.ATOM_TYPE

AtmLink.HRef = "http://www.google.com/base/feeds/items";

AtmLink.Rel = "http://schemas.google.com/g/2005#feed";

AmFeed.Links.Add(AtmLink)

AtmLink = New AtomLink

AtmLink.Type = AtomLink.ATOM_TYPE

AtmLink.HRef = "http://www.google.com/base/feeds/items";

AtmLink.Rel = "http://schemas.google.com/g/2005#post";

AmFeed.Links.Add(AtmLink)

AtmLink = New AtomLink

AtmLink.Type = AtomLink.ATOM_TYPE

AtmLink.HRef = "http://www.google.com/base/feeds/items/batch";

AtmLink.Rel = "http://schemas.google.com/g/2005#batch";

AmFeed.Links.Add(AtmLink)

Dim entry As GBaseEntry

entry = New GBaseEntry

''''''''''Author''''''''''''''''''''

Dim author As AtomPerson = New AtomPerson

author.Name = objGoogle.Author

author.Email = objGoogle.Email

entry.Authors.Add(author)

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Dim AmCategory As AtomCategory

Dim Amuri As AtomUri = New AtomUri("
http://base.google.com/categories/itemtypes";)

AmCategory = New AtomCategory("Proudcts", Amuri)

entry.Categories.Add(AmCategory)

''''''''''''''''''''''''''''''''''''

entry.BatchData = New GDataBatchEntryData

entry.BatchData.Id = 1

entry.GBaseAttributes.ItemType = "Products"

entry.GBaseAttributes.AddTextAttribute("target_country", "US")

entry.GBaseAttributes.AddTextAttribute("item_language", "EN")

author.Email = objGoogle.Email

entry.Title.Text = ds.Tables(0).Rows(0).Item("prd_Name").ToString()

entry.Title.Type = AtomTextConstructType.text

entry.Content.Type = AtomTextConstructType.html

entry.Content.Content = ds.Tables(0).Rows(0).Item("prd_SmallDescription"
).ToString()

entry.GBaseAttributes.Location = objGoogle.Location

entry.GBaseAttributes.ItemType = "Products"

entry.GBaseAttributes.ExpirationDate = objGoogle.ExpriryDate

'''''''''''''''''''''''''

entry.GBaseAttributes.AddTextAttribute("color", "White")

entry.GBaseAttributes.AddTextAttribute("year", Now.Year)

entry.GBaseAttributes.AddTextAttribute("expiration_date",
objGoogle.ExpriryDate) ''''''''''''''''

entry.GBaseAttributes.AddTextAttribute("condition", "New")

entry.GBaseAttributes.AddTextAttribute("brand", ds.Tables(0).Rows(0).Item(
"Brand").ToString())

entry.GBaseAttributes.AddTextAttribute("description", "This product is for
me and used for selling and that's why we use")
'ds.Tables(0).Rows(0).Item("prd_LargeDescription").ToString())

entry.GBaseAttributes.AddTextAttribute("id", ds.Tables(0).Rows(0).Item(
"prd_Id").ToString())

Dim StrImageLinks() As String = {"
http://ecom.owebz.com/userimages/product/P-O-3451386968.jpg"}

entry.GBaseAttributes.ImageLinks = StrImageLinks

entry.GBaseAttributes.AddUrlAttribute("link", "
http://ecom.owebz.com/product-details.aspx?Id="; & ds.Tables(0).Rows(0).Item(
"prd_Id").ToString())

Dim strPrice As New Google.GData.GoogleBase.FloatUnit("99.99", "usd")
'ds.Tables(0).Rows(0).Item("prd_Price").ToString()

entry.GBaseAttributes.Price = strPrice

entry.GBaseAttributes.PriceType = "Fixed"

entry.GBaseAttributes.PriceUnits = "USD"

entry.GBaseAttributes.AddNumberUnitAttribute("height", CInt
(ds.Tables(0).Rows(0).Item("prd_Height").ToString), "inches")

entry.GBaseAttributes.AddNumberUnitAttribute("Width", CInt
(ds.Tables(0).Rows(0).Item("prd_Width").ToString), "inches")

entry.GBaseAttributes.AddNumberUnitAttribute("length", CInt
(ds.Tables(0).Rows(0).Item("prd_Length").ToString), "inches")

'''''''''Adding Custom Attributes'''''''''''''''''''''''''''''''''

entry.GBaseAttributes.AddTextAttribute("SKU Code",
ds.Tables(0).Rows(0).Item("prd_SKUCode").ToString())

entry.GBaseAttributes.AddTextAttribute("ManufacturerPartNumber",
ds.Tables(0).Rows(0).Item("prd_ManufacturerPartNumber").ToString())

''''''''''''''''''''''''''''''''''''''''''''

If ds.Tables(1).Rows.Count > 0 Then

entry.GBaseAttributes.AddTextAttribute("product_type",
ds.Tables(1).Rows(0).Item("Category").ToString())

End If

entry.GBaseAttributes.Quantity = 10

'''''''''''Payment Attributees' '''''''''''''''''''''''''''''

Dim strPaymentMethods() As String = {"Visa"}

entry.GBaseAttributes.PaymentMethods = strPaymentMethods

entry.GBaseAttributes.PaymentNotes = "Google Checkout, Authorize DotNet"

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

entry.BatchData.Type = GDataBatchOperationType.insert

AmFeed.Entries.Add(entry)

Dim returnFeed As GBaseFeed = service.Batch(AmFeed, New Uri(AmFeed.Batch))

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Base Data API" group.
To post to this group, send email to Google-Base-data-API@googlegroups.com
To unsubscribe from this group, send email to 
google-base-data-api+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Base-data-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to