In the last if block, try doing something more useful than just register
"errors encountered".
Get the error message that the server returned to you. The error message
should give you
enough information to know what is wrong with the item you provided.
If entry1.BatchData.Status.Code > 300 Then
'lblMsg.Text = *!!! here get the error message (or messages,
if more)*
Exit Sub
End If
At the first glance, you don't specify a g:id entry. See the following link
for requirements
when submitting product items:
http://code.google.com/apis/base/starting-out.html#products
<http://code.google.com/apis/base/starting-out.html#products>This list is
not exhaustive, and you should check the feed specification and try to
provide all the required attributes:
http://base.google.com/support/bin/answer.py?hl=en&answer=73932
<http://base.google.com/support/bin/answer.py?hl=en&answer=73932>Alex
On Tue, May 26, 2009 at 8:42 PM, Ajay <[email protected]> wrote:
>
> Hi,
> I have created the Google Base and it stopped working. I have been
> trying since three months to fix this issue but no success...
> The code is shown below...
> If any mistakes please let me know and advise...
>
> Dim gbase_applicationName As String = "Base test"
> Dim gbase_applicationKey As String = Appkey.Text
> Dim gbase_userName As String = "[email protected]"
> Dim gbase_password As String = "Password"
> Dim i As Integer
> i = 102
>
> Dim service As GBaseService = New GBaseService
> (gbase_applicationName, gbase_applicationKey)
> service.setUserCredentials(gbase_userName, gbase_password)
> Dim query As GBaseQuery = New GBaseQuery("http://
> base.google.com/base/feeds/items")
> Dim feed As GBaseFeed = service.Query(query)
>
> service.setUserCredentials(gbase_userName, gbase_password)
>
>
> Dim batchFeed As AtomFeed = New AtomFeed(feed)
> 'batchFeed = feed
>
>
> batchFeed.BatchData = New GDataBatchFeedData
> batchFeed.BatchData.Type = GDataBatchOperationType.insert
>
>
> Dim entry As GBaseEntry = New GBaseEntry
> Dim author As AtomPerson = New AtomPerson
> author.Name = "Author"
>
> entry.Authors.Add(author)
>
>
> entry.BatchData = New GDataBatchEntryData
> entry.BatchData.Id = i.ToString()
> entry.GBaseAttributes.Price = New FloatUnit(Convert.ToSingle
> (2.99), "GBP")
> entry.GBaseAttributes.PriceUnits = "item"
> entry.Content.Type = "text/html"
> entry.Title.Text = "Testing how to add Items to GBase"
> entry.Content.Content = "Content"
> entry.GBaseAttributes.AddTextAttribute("Condition", "New")
> entry.GBaseAttributes.ItemType = "products"
> Dim lnk As New AtomLink
> lnk.HRef = New AtomUri("http://example.com")
> lnk.Rel = "alternate"
> lnk.Dirty = False
> lnk.Type = "text/html"
> entry.Links.Add(lnk)
> lnk = Nothing
>
> entry.BatchData.Type = GDataBatchOperationType.insert
>
>
> batchFeed.Entries.Add(entry)
>
>
> ' upload
> Dim returnFeed As GBaseFeed = service.Batch(batchFeed, New Uri
> (batchFeed.Batch))
>
>
> For Each entry1 As GBaseEntry In returnFeed.Entries
>
>
> If entry1.BatchData.Status.Code > 300 Then
> 'lblMsg.Text = "errors encountered"
>
>
> Exit Sub
> End If
> Next
>
> >
>
--
Alex Dovlecel, Google Switzerland GmbH
Company Identifikationsnummer: CH-020.4.028.116-1
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Base-data-API?hl=en
-~----------~----~----~----~------~----~------~--~---