4 messages in com.googlegroups.google-base-data-apiRe: need help for media feed using C#...
FromSent OnAttachments
test23 Mar 2008 23:56 
Jeff S26 Mar 2008 14:29 
AeMfs15 Apr 2008 02:27 
Eric15 Apr 2008 13:28 
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.

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 -