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 8110115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:38:31+00:00 2026-06-06T01:38:31+00:00

This code work. It create a document kind entry. I only change content of

  • 0

This code work. It create a document kind entry.
I only change content of variable:body(term=’http://schemas.google.com/docs/2007#document&#8217; to term=’http://schemas.google.com/docs/2007#file&#8217;). After sending request, server return response<400 Bad Request>. It’s very strange. I traced Google Data API’s source code, and I found the kind(http://schemas.google.com/docs/2007#file). How do I modify code to create file kind entry. Thanks.

HttpWebRequest call = null;
HttpWebResponse echo = null;

StreamWriter send = null;
StreamReader read = null;

string data = string.Empty;
string body = string.Empty;

body = "<?xml version='1.0' encoding='UTF-8'?>
    <entry xmlns='http://www.w3.org/2005/Atom'
        xmlns:docs='http://schemas.google.com/docs/2007'>
        <category scheme='http://schemas.google.com/g/2005#kind'
            term='http://schemas.google.com/docs/2007#document'/>
        <title>test.txt</title>
    </entry>";

call = HttpWebRequest.Create("https://docs.google.com/feeds/default/private/full") as HttpWebRequest;

call.Method = "POST";
call.Headers.Add("GData-Version: 3.0");
call.Headers.Add("Authorization: Bearer " + Access_Token);
call.ContentType = "application/atom+xml";
call.ContentLength = Encoding.UTF8.GetBytes(body).Length;
call.Headers.Add("X-Upload-Content-Length: 0");

send = new StreamWriter(call.GetRequestStream());
send.Write(body);
send.Close();
send.Dispose();

echo = call.GetResponse() as HttpWebResponse;
if (echo.StatusCode == HttpStatusCode.Created)
{
    read = new StreamReader(echo.GetResponseStream());
    data = read.ReadToEnd();
    MessageBox.Show("entry.xml:" + Enviroment.NewLine + data);
    read.Close();
    read.Dispose();
}
else
{
    MessageBox.Show("entry not created. " + echo.StatusCode.ToString() + "(" + echo.StatusDescription + ")");
}
echo.Close();

Then, I wanna create a file kind entry. I modified code.

body = "<?xml version='1.0' encoding='UTF-8'?>
    <entry xmlns='http://www.w3.org/2005/Atom'
        xmlns:docs='http://schemas.google.com/docs/2007'>
        <category scheme='http://schemas.google.com/g/2005#kind'
            term='http://schemas.google.com/docs/2007#file'/>
        <title>test.exe</title>
    </entry>";

call = HttpWebRequest.Create("https://docs.google.com/feeds/default/private/full?convert=false") as HttpWebRequest;

call.Method = "POST";
call.Headers.Add("GData-Version: 3.0");
call.Headers.Add("Authorization: Bearer " + Access_Token);
call.ContentType = "application/atom+xml";
call.ContentLength = Encoding.UTF8.GetBytes(body).Length;
call.Headers.Add("X-Upload-Content-Length: 0");

send = new StreamWriter(call.GetRequestStream());
send.Write(body);
send.Close();
send.Dispose();

echo = call.GetResponse() as HttpWebResponse;

return 400 Bad Request

body = "<?xml version='1.0' encoding='UTF-8'?>
    <entry xmlns='http://www.w3.org/2005/Atom'
        xmlns:docs='http://schemas.google.com/docs/2007'>
        <category scheme='http://schemas.google.com/g/2005#kind'
            term='http://schemas.google.com/docs/2007#document'/>
        <title>test.exe</title>
    </entry>";

call = HttpWebRequest.Create("https://docs.google.com/feeds/default/private/full?convert=false") as HttpWebRequest;

call.Method = "POST";
call.Headers.Add("GData-Version: 3.0");
call.Headers.Add("Authorization: Bearer " + Access_Token);
call.ContentType = "application/atom+xml";
call.ContentLength = Encoding.UTF8.GetBytes(body).Length;
call.Headers.Add("X-Upload-Content-Length: 0");

send = new StreamWriter(call.GetRequestStream());
send.Write(body);
send.Close();
send.Dispose();

echo = call.GetResponse() as HttpWebResponse;

return 403 Forbidden

  • 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. Editorial Team
    Editorial Team
    2026-06-06T01:38:32+00:00Added an answer on June 6, 2026 at 1:38 am

    Check the docs at https://developers.google.com/google-apps/documents-list/#creating_or_uploading_files, what you have to do is add ?convert=false to the upload url.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the this code that will create excel file and work sheet then
Why doesn't this code work? b if b = true Error: undefined local variable
How do you make this code work? Just have pyglet installed and change fireball.png
I use this code to create a simple jquery carousel animation: $(document).ready(function() { var
Does this code work across all standard compliant C++ compilers (it works with g++)?
How can I make this code work? #!/bin/bash ARRAYNAME='FRUITS' FRUITS=( APPLE BANANA ORANGE )
How does this code work to Find the next highest power of 2 for
Subtitle: why does this code work? It seems to allow comparison of NSNumber with
How can I make this code work? class Meta @array = [:a,:b] def self.method_missing(name,
Why doesn't this code work in IE6 or IE7? $('a').click( function() { var urlIsExternal

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.