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

  • SEARCH
  • Home
  • 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

I'm trying to scroll a textbox using the form's WndProc method. The code I've
I'm in the process of developing an application that uses client side code (js
After debugging a CodeIgniter application that were installed into a new development environment, I
After reading up on the JQGrid control, I decided it would be good to
After developing mini project with WCF duplex (Chat Service | Sms Service), I got
After I click button1, it display 0, why? How can get correct width of
I am developing an OpenID consumer in PHP and am using the fantastic LightOpenID
I am trying to have a label display single-digit numbers as double-digit numbers (ie.
I'm using an automatically created (with wsdl.exe and the GUI-based Add web reference command)
I am working on an application for Windows Mobile 6 (or maybe 5) that

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.