OK everybody, it seems that Julian will not spell it because the
solution came as a response to a Premiere Account support ticket! I
was the initiator, and he was the replier. Ok, just kidding :) I'm
sure your problems are most probably different, anyhow...
Here is my code that used to produce the error 500
VB.Net:
++++++++++++++++++++++++++++++
Imports Google
Imports System.IO
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim fs As New FileStream("c:\person_photo.jpg", FileMode.Open,
FileAccess.Read)
Dim x As New GData.Contacts.ContactsService("test")
x.setUserCredentials("[email protected]", "user's_password")
Dim q = x.Query(New GData.Contacts.ContactsQuery("http://
www.google.com/m8/feeds/contacts/[email protected]/full?max-results=999"))
For Each ent In q.Entries
Dim contEntry As GData.Contacts.ContactEntry = TryCast(ent,
GData.Contacts.ContactEntry)
If contEntry.PrimaryEmail.Address.Contains("perosn") Then
x.Update(contEntry.PhotoEditUri, fs, "image/jpg",
"Contact Photo")
End If
Next
MessageBox.Show("LoopEnded")
End Sub
End Class
++++++++++++++++++++++++++++++
And here is Julian's fix...
VB.Net:
++++++++++++++++++++++++++++++
Imports Google
Imports System.IO
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim fs As New FileStream("c:\person_photo.jpg", FileMode.Open,
FileAccess.Read)
Dim x As New GData.Contacts.ContactsService("test")
x.setUserCredentials("[email protected]", "user's_password")
Dim q = x.Query(New GData.Contacts.ContactsQuery("http://
www.google.com/m8/feeds/contacts/[email protected]/full?max-results=999"))
For Each ent In q.Entries
Dim contEntry As GData.Contacts.ContactEntry = TryCast(ent,
GData.Contacts.ContactEntry)
If contEntry.PrimaryEmail.Address.Contains("perosn") Then
x.Update(contEntry.PhotoEditUri, fs, "image/jpg",
"Contact Photo")
fs.Seek(0, SeekOrigin.Begin) ' Notice this
additional line which is all that it takes!!
End If
Next
MessageBox.Show("LoopEnded")
End Sub
End Class
++++++++++++++++++++++++++++++
Julian also noted: "I found a problem with the FileStream, it is
necessary to move the position to the beginning using Seek after each
use"
I do not know about file type support, but it should never be a
problem.
BR,
Khallaf
On Jan 20, 4:42 pm, "Julian (Google)" <[email protected]> wrote:
> I'll post back any news on this. Thanks for the information.
>
> Cheers,
> Julian
>
> On Jan 19, 5:59 pm, Charlie Wood <[email protected]> wrote:
>
> > I'm not sure what file types were involved when these errors occurred.
> > I just tried an uncompressed TIFF and an LZW-compressed TIFF (once
> > each) and they both worked fine.
>
> > Let me know if you need more data and I'll turn up the logging level
> > on that code.
>
> > Thanks,
> > Charlie
>
> > On Jan 19, 11:41 am, "Julian (Google)" <[email protected]> wrote:
>
> > > Hi Steve,
>
> > > I was able to reproduce the problem when using TIFF files, the same
> > > image worked fine when transform to JPG. I'll escalate the issue.
>
> > > Did you have the problem with any other image formats? Were you able
> > > to upload any TIFF images?
>
> > > Charlie, Did you have the same problem using TIFF files?
>
> > > Cheers,
> > > Julian.
>
> > > On Jan 19, 1:10 pm, Charlie Wood <[email protected]> wrote:
>
> > > > FWIW we're seeing quite a few 500 errors when trying to create/update
> > > > contact photos too.
>
> > > > Thanks,
> > > > Charlie
>
> > > > On Jan 19, 2:49 am, SteveC <[email protected]> wrote:
>
> > > > > Folks;
>
> > > > > I am seeing some strange 'GDataServiceDomain error 500' when uploading
> > > > > photos.
>
> > > > > I see an earlier thread with similar issue in which Google suggests
> > > > > that a fix was coming.
> > > > > This was in Nov 08 - has that fix been propogated?
>
> > > > > I can upload photos sometimes but not always!
> > > > > It most often occurs when reading a file and then passing the contents
> > > > > of the file.
> > > > > I am using the ObjC SDK if that is material to this issue.
>
> > > > > NSData *uploadData = [NSData dataWithContentsOfFile:path];
> > > > > if (!uploadData) {
> > > > > NSLog(@"cannot read file %@", path);} else {
>
> > > > > thisImage =[[[NSImage alloc] initWithData:uploadData]
> > > > > autorelease];
> > > > > newEntry = [GDataEntryContact
> > > > > contactEntryWithTitle:@"UploadingPhoto
> > > > > ContactEntryTitle"]; [newEntry setUploadData:[thisImage
> > > > > TIFFRepresentation]];
> > > > > [newEntry setUploadMIMEType:@"image/tiff"];
> > > > > [newEntry
> > > > > setUploadSlug:@"ContactImageFileSlug"];
> > > > > ticket = [[self contactService]
> > > > > fetchContactEntryByUpdatingEntry:newEntry forEntryURL:theURL
> > > > > delegate:self
> > > > > didFinishSelector:@selector
> > > > > (loadContactImageFilesTicket:finishedWithEntry:)
> > > > > didFailSelector:@selector
> > > > > (loadContactImageFilesTicket:failedWithError:)];
>
> > > > > }
>
> > > > > The files are valid tiff files.
> > > > > Any thoughts appreciated!
> > > > > Steve
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Contacts 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-contacts-api?hl=en
-~----------~----~----~----~------~----~------~--~---