login about faq

I am trying to upload a file to a shared onedrive folder using rest. the link begins with "https://1drv.ms//f//s!A.... the lasterrortext is

/
ChilkatLog:
  Connect(15ms):
    DllDate: Mar 23 2017
    ChilkatVersion: 9.5.0.66
    UnlockPrefix: Anything for 30-day trial
    Architecture: Little Endian; 64-bit
    Language: .NET 4.5 / x64
    VerboseLogging: 1
    socket2Connect(15ms):
      connect2(15ms):
        hostname: https://1drv.ms//f//s!A...
        port: 433
        ssl: 1
        connectImplicitSsl:
          Clearing TLS client certificates.
          connectSocket:
            domainOrIpAddress: https://1drv.ms//f//s!A...
            port: 433
            connectTimeoutMs: 30000
            connect_ipv6_or_ipv4:
              Multi-threaded domain to IP address resolution
              resolveHostname6:
                getAddressInfo:
                  Failed to get host address info. (3)
                  SocketError: WSAHOST_NOT_FOUND No such host is known.

              hostOrIpAddr: 1drv.msfs!A....
              **This is missing the / on either side of the f**

              port: 433
              Versions of Windows earlier than Windows XP are limited to handling IPv4 only
              On Windows Server 2003 and Windows XP, IPv6 addresses are returned only if IPv6 is installed on the local computer.
            --getAddressInfo
          --resolveHostname6
          Domain to IP address resolution failed.
        --connect_ipv6_or_ipv4
      --connectSocket
      pmConnect failed.
    --connectImplicitSsl
    ConnectFailReason: DNS lookup failed
  --connect2
--socket2Connect
Failed.

--Connect --ChilkatLog

asked Apr 11 at 19:07

ibj50's gravatar image

ibj50
1

edited Apr 11 at 19:14


Thanks! The Connect method expects a domain name or IP address to be passed to it. You passed "https://1drv.ms//f//s!A...", which is the full URL. You should instead pass only "1drv.ms" which is the domain part of the URL.

link

answered Apr 12 at 07:13

chilkat's gravatar image

chilkat ♦♦
12.5k317361456

Ok it is now connecting. Here is my code:

       string myonedrive = "/f/";
        string remoteuri = "https://1drv.ms/f/s!AvS4YOUC92...";
        string fileName = "C:\\WITS TS\\weightags\\witsxaf.txt"; 
        byte[] bites = System.IO.File.ReadAllBytes(fileName);

        Chilkat.Global glob = new Chilkat.Global();
        bool success = glob.UnlockBundle("Anything for 30-day trial");

        //WebClient myclient = new WebClient();
        //myclient.UploadFile(remoteuri, fileName);

        //myclient.UploadData(remoteuri, "PUT", bites);

        Chilkat.Rest rest = new Chilkat.Rest();

        rest.VerboseLogging = true;
        rest.AddHeader("Content-Type", "application/octet-stream");
        success = rest.AddHeader("content-disposition", "form-data; name = file ; filename="+fileName+'"');
        rest.AddHeader("Authorization", "s!AvS4YOUC92....");
        success = rest.Connect("1drv.ms", 443, true, true);

        Chilkat.Stream filestrem = new Stream();
        filestrem.SourceFile = fileName;

        string responsestr = rest.FullRequestStream("PUT", myonedrive , filestrem);

But I am getting the following error:

/
ChilkatLog:
  FullRequestStream(79ms):
    DllDate: Mar 23 2017
    ChilkatVersion: 9.5.0.66
    UnlockPrefix: Anything for 30-day trial
    Architecture: Little Endian; 64-bit
    Language: .NET 4.5 / x64
    VerboseLogging: 1
    sendReqStreamBody:
      sendReqStreamNC:
        sendReqStreamNonChunked:
          sendReqHeader:
            uriPath: /f/
            constructStartLine:
              uriPath: /f/
            --constructStartLine
            getMimeHeaderHttp:
              headerField: Host: 1drv.ms
              headerField: Content-Type: application/octet-stream
              headerField: content-disposition: form-data; name =file; filename="C:WITS TSweightagswitsxaf.txt"
              headerField: Authorization: s!AvS4YOUC92....
              headerField: Content-Length: 469
            --getMimeHeaderHttp
            requestHeader: [PUT /f/ HTTP/1.1
Host: 1drv.ms
Content-Type: application/octet-stream
content-disposition: form-data; name =file; filename="C:WITS TSweightagswitsxaf.txt"
Authorization: s!AvS4YOUC92....
Content-Length: 469

] --sendReqHeader --sendReqStreamNonChunked --sendReqStreamNC --sendReqStreamBody fullRequestGetResponse(79ms): Reading response header... responseHeader: [HTTP/1.1 405 Method Not Allowed Content-Length: 103 Content-Type: application/json; charset=utf-8 Server: Microsoft-IIS/8.5 X-MSNSERVER: DM5SCH102220908 Strict-Transport-Security: max-age=31536000; includeSubDomains X-QosStats: {"ApiId":0,"ResultType":2,"SourcePropertyId":0,"TargetPropertyId":42} X-ThrowSite: 4d6d.dbc6 X-AsmVersion: UNKNOWN; 22.1.0.0 X-MSEdge-Ref: Ref A: 67A3CBEAE8464A7A83A5A92582510BDD Ref B: PAOEDGE0419 Ref C: Wed Apr 12 09:15:54 2017 PST Date: Wed, 12 Apr 2017 16:15:54 GMT

] responseStatusCode: 405 Reading response body... --fullRequestGetResponse Success. --FullRequestStream --ChilkatLog

I get the same error 405 when trying to use webclient.

link

answered Apr 12 at 12:24

ibj50's gravatar image

ibj50
1

I'll try to get some examples out in the next few days..

link

answered Apr 12 at 12:34

chilkat's gravatar image

chilkat ♦♦
12.5k317361456

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×30

Asked: Apr 11 at 19:07

Seen: 311 times

Last updated: Apr 12 at 12:34

powered by OSQA