Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 159331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T10:50:23+00:00 2026-05-11T10:50:23+00:00

So after scouring the Internet I pieced together the following code to upload a

  • 0

So after scouring the Internet I pieced together the following code to upload a photo for a Google Contact:

System.Drawing.Bitmap Image = new Bitmap( @'C:\test.jpg' ); System.IO.MemoryStream Memory = new MemoryStream(); Image.Save( Memory, System.Drawing.Imaging.ImageFormat.Jpeg );  Service.Update     (         Contact.PhotoEditUri,          Memory,          'image/jpeg',          null     ); 

The Service is using ClientLogin authentication. Before this code runs, I have successfully retrieved the contact.

After this code runs, however, I get a GDataRequestException. The error message returned is, ‘A temporary internal problem has occurred. Try again later’. The error message in the InnerException contains the following, ‘The remote server returned an error: (500) Internal Server Error.’

After yet more research, I found hints that the error codes from the Google service may not be all that descriptive – and may simply return error 500. Though I don’t know how true this is.

So maybe the problem is with my code? Or even better, does anybody have sample code to demonstrate how this should be done?

Thanks,

Camel

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T10:50:24+00:00Added an answer on May 11, 2026 at 10:50 am

    I found out two ways to resolve this problem (the transcript is in this Google Contacts API post). First, you can create a stream that accesses the file directly, like so:

    System.IO.FileStream File = new FileStream( @'C:\test.jpg' );  Service.Update     (         Contact.PhotoEditUri,          File,          'image/jpeg',          null     ); 

    Second, the reason why my original code failed was because I had to reset the position inside the MemoryStream. This is what I get for being such a noob on streams. Once the Image.Save function completes, the position is at the end. So, all you have to do is reset the position to the beginning:

    System.Drawing.Bitmap Image = new Bitmap( @'C:\test.jpg' ); System.IO.MemoryStream Memory = new MemoryStream(); Image.Save( Memory, System.Drawing.Imaging.ImageFormat.Jpeg ); Memory.Seek( 0, SeekOrigin.Begin );  Service.Update     (         Contact.PhotoEditUri,          Memory,          'image/jpeg',          null     ); 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After doing an AJAX call, am redirecting- using the following code. But, after AJAX
So from scouring the internet I managed to find an apparently working Google Voice
After a system upgrade i am no longer able to start my tomcat5 server.
After following the RoR getting started tutorial, I added another model as: $ rails
After I click update in the grid view, the code works successfully. But when
After scouring the net for answers, coming up with almost solutions... I decided to
After looking over the of the NHibernate.Envers code I realized I was implementing the
After following: https://github.com/plataformatec/devise/wiki/OmniAuth:-Overview I can sign up a user via Facebook. But I'm struggling
I haven't found a clear answer to this after a fair amount of scouring
I'm sure that this is very straight-forward, however, after scouring the net I can't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.