Re: Attempting to upload a file to a SharePoint 2010 server



Dear Dan,

Thank you for your response.

Yes After digging a bit deeper I discovered the "PUT" tests and from that was able to create a working example that uploads a file.  With that initial working upload I was able to learn a lot about how libsoup works and from there was able to create a working method that does what I need.  With a lack of any good examples of how to use libsoup, the tests   are really the only way for a newbie like me to have any chance of attempting to use libsoup.  On the other hand once I am able to get one thing working it leads to more understanding.

David



On Tue, Jun 19, 2012 at 10:26 AM, Dan Winship <danw gnome org> wrote:
On 06/18/2012 11:47 AM, David C Abrames wrote:
> Hi,
>
> I am trying to upload document files to a SharePoint 2010 library using
> HTTP PUT.  I found the streaming-test.c file which I am thinking is the
> example I need to use but I can't seem to figure out what the code is
> doing.

The programs in tests/ are generally more about unit/regression testing,
and poking obscure corners of the code in bizarre ways to make sure that
everything still works. They're mostly not good starting points for
doing anything *sane*... (Also, streaming-test is about streaming the
response body, not the request body, so it's all backwards from what you
want to do anyway.)

If you already have the entire contents of the file in memory, then all
you have to do is add it to the SoupMessage's request_body, with
soup_message_set_request(), or soup_message_body_append() or
soup_message_body_append_buffer().

If you want to stream the PUT body so that only part of the file is in
memory at any given time, then it gets a lot trickier. The
"PROPER_STREAMING" test in tests/chunk-test does this, although again,
it's mixed in with various sanity tests and unrelated things. But the
idea is that after the message emits wrote-headers, you write the first
request body chunk, and then after every wrote-body-data signal you
append another chunk. (And you call
soup_message_body_set_accumulate(msg->request_body, FALSE) to tell
libsoup to not save all the chunks to merge them together at the end,
and you probably also want to set the SOUP_MESSAGE_CAN_REBUILD flag to
tell it that if the message gets restarted due to redirection or
authentication, that you're able to start over again.)

-- Dan



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]