4 messages in com.googlegroups.google-base-data-apiRe: need help for media feed using C#...| Subject: | Re: need help for media feed using C# client library![]() |
|---|---|
| From: | Eric (api....@google.com) |
| Date: | 04/15/2008 01:28:45 PM |
| List: | com.googlegroups.google-base-data-api |
AeMfs,
Try casting the service to a GBaseEntry instead of a PicasaEntry:
GBaseEntry baseentry = (GBaseEntry) service.Insert(new Uri("http:// www.google.com/base/feeds/items/" + editUri + "/media/"),fileStream, "image/jpeg", file);
Let me know if this doesn't fix the problem.
Eric
On Apr 15, 2:27 am, AeMfs <aemf...@gmail.com> wrote:
Hello Jeff,
I tried with Picasa photo upload method to post an image to Google base. I've succesfully uploaded images to google base. Thanks for your suggestion.
Following is the code snippet for photo upload to google base.
**************************************************************************************
GBaseEntry insertEntry = service.Insert(GBaseUriFactory.Default.ItemsFeedUri , entry);
editUri = insertEntry.EditUri.ToString(); int count = 0; count = editUri.LastIndexOf("/",editUri.Length); editUri = editUri.Substring(count + 1 ,editUri.Length - (count + 1));
string file = ConfigurationSettings.AppSettings["PhotoDirectory"].ToString() + "photo.jpg"; System.IO.FileInfo fileInfo = new System.IO.FileInfo(file); System.IO.FileStream fileStream = fileInfo.OpenRead();
try
{
PicasaEntry picentry = (PicasaEntry) service.Insert(new
Uri("http://www.google.com/base/feeds/items/" + editUri + "/media/"),fileStream,
"image/jpeg", file);}
catch(Exception ex) {
}
fileStream.Close();
**************************************************************************************
But after a photo have been posted to google base, the PicasaEntry throwing an exception like Error Message : System.InvalidCastException: Specified cast is not valid.
Any idea how to fix this?? please advice.
Thanks AeMfs
On Mar 27, 2:30 am, Jeff S <j....@google.com> wrote:
Hi test,
I haven't tried to insert images to the media feed yet using C#, but you might find some hints by looking at samples for the Picasa Web Albums API, since the process is similar.
Please let me know if you hit any snags. It might also be good to mention this on the .NET library group because there might be some changes that could be made to the client library that would make it easier to upload images to an item's media feed.
Cheers,
Jeff
On Mar 23, 11:56 pm, test <test...@gmail.com> wrote:
Hello everybody,
Does anybody has idea how to send images to Google Base using media feed in C# client library. I found examples in java , but I want to do this in C#.
Do we need any specific reference to achieve this in C#. I'll be greatful for any help.
thanks- Hide quoted text -
- Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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 Goog...@googlegroups.com
To unsubscribe from this group, send email to
Goog...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/Google-Base-data-API?hl=en
-~----------~----~----~----~------~----~------~--~---




