Upload file to sharepoint via curl











up vote
-1
down vote

favorite












I have been trying to upload a file to our SharePoint server for a couple of weeks with no success.



I need to be able to send the file from a Linux server and get it into Microsoft teams. To achieve this I am been trying to send the file to SharePoint via Curl.



I have read several post on here and elsewhere but I cannot see to get it to work.



These are the commands I have been trying with the outputs. Please, can someone tell me where I am going wrong?



curl -L -A "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0" -O --user domain/username:password -T failed.csv https://mysite.sharepoint.com/sites/testwebhook/Shared%20Documents/General/failed.csv -vvv


% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* About to connect() to mysite.sharepoint.com port 443 (#0)
* Trying xxx.xxx.xxx.xxx...
* Connected to mysite.sharepoint.com (xxx.xxx.xxx.xxx) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none
* SSL connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate:
* subject: CN=*.sharepoint.com,OU=Microsoft Corporation,O=Microsoft Corporation,L=Redmond,ST=WA,C=US
* start date: Mar 07 21:35:03 2018 GMT
* expire date: Mar 06 21:35:03 2020 GMT
* common name: *.sharepoint.com
* issuer: CN=Microsoft IT TLS CA 1,OU=Microsoft IT,O=Microsoft Corporation,L=Redmond,ST=Washington,C=US
* Server auth using Basic with user 'domain/username'
> PUT /sites/testwebhook/Shared%20Documents/General/failed.csv HTTP/1.1
> Authorization: Basic c3BvcnRwZXNhLmNvbS9waGlsLmJyYWR5QDp6R0FWYnRmN2Y2Z1FjbEJFdG9Udw==
> User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0
> Host: mysite.sharepoint.com
> Accept: */*
> Content-Length: 1633
> Expect: 100-continue
>
< HTTP/1.1 100 Continue
} [data not shown]
* We are completely uploaded and fine
< HTTP/1.1 302 Found
< Content-Length: 272
< Content-Type: text/html; charset=utf-8
< Location: https://mysite.sharepoint.com/sites/testwebhook/_layouts/15/Authenticate.aspx?Source=%2Fsites%2Ftestwebhook%2FShared%20Documents%2FGeneral%2Ffailed%2Ecsv
< P3P: CP="ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI"
< X-SharePointHealthScore: 2
< SPRequestGuid: fa84a49e-e046-0000-38b8-14009af2f9eb
< request-id: fa84a49e-e046-0000-38b8-14009af2f9eb
< MS-CV: nqSE+kbgAAA4uBQAmvL56w.0
< X-Powered-By: ASP.NET
< MicrosoftSharePointTeamServices: 16.0.0.8314
< X-Content-Type-Options: nosniff
< X-MS-InvokeApp: 1; RequireReadOnly
< X-MSEdge-Ref: Ref A: 60B7BACBCB0F48ADB6510D0754726C3E Ref B: LON21EDGE0609 Ref C: 2018-11-21T11:58:29Z
< Date: Wed, 21 Nov 2018 11:58:29 GMT
<
* Ignoring the response-body
{ [data not shown]
100 1905 100 272 100 1633 940 5644 --:--:-- --:--:-- --:--:-- 5650
* Connection #0 to host mysite.sharepoint.com left intact
* Issue another request to this URL: 'https://mysite.sharepoint.com/sites/testwebhook/_layouts/15/Authenticate.aspx?Source=%2Fsites%2Ftestwebhook%2FShared%20Documents%2FGeneral%2Ffailed%2Ecsv'
* Found bundle for host mysite.sharepoint.com: 0x11eb340
* Re-using existing connection! (#0) with host mysite.sharepoint.com
* Connected to mysite.sharepoint.com (xxx.xxx.xxx.xxx) port 443 (#0)
* Server auth using Basic with user 'domain:'
> PUT /sites/testwebhook/_layouts/15/Authenticate.aspx?Source=%2Fsites%2Ftestwebhook%2FShared%20Documents%2FGeneral%2Ffailed%2Ecsv HTTP/1.1
> Authorization: Basic c3BvcnRwZXNhLmNvbS9waGlsLmJyYWR5QDp6R0FWYnRmN2Y2Z1FjbEJFdG9Udw==
> User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0
> Host: mysite.sharepoint.com
> Accept: */*
> Content-Length: 1633
> Expect: 100-continue
>
< HTTP/1.1 100 Continue
} [data not shown]
* We are completely uploaded and fine
< HTTP/1.1 405 Method Not Allowed
< Allow: GET, HEAD, OPTIONS, TRACE
< P3P: CP="ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI"
< X-SharePointHealthScore: 2
< SPRequestGuid: fa84a49e-f044-0000-38b8-1bd5894edf98
< request-id: fa84a49e-f044-0000-38b8-1bd5894edf98
< MS-CV: nqSE+kTwAAA4uBvViU7fmA.0
< Strict-Transport-Security: max-age=31536000
< X-FRAME-OPTIONS: SAMEORIGIN
< SPRequestDuration: 15
< SPIisLatency: 2
< X-Powered-By: ASP.NET
< MicrosoftSharePointTeamServices: 16.0.0.8314
< X-Content-Type-Options: nosniff
< X-MS-InvokeApp: 1; RequireReadOnly
< X-MSEdge-Ref: Ref A: 3DB34D91446A4556978DF6B7BABD5907 Ref B: LON21EDGE0609 Ref C: 2018-11-21T11:58:29Z
< Date: Wed, 21 Nov 2018 11:58:29 GMT
< Content-Length: 0
<
100 1633 0 0 100 1633 0 4842 --:--:-- --:--:-- --:--:-- 4842
* Connection #0 to host mysite.sharepoint.com left intact


AND



curl --ntlm --user domain/username:password -T failed.csv https://mysite.sharepoint.com/sites/testwebhook/Shared-Documents/General/failed.csv -vvv
* About to connect() to mysite.sharepoint.com port 443 (#0)
* Trying xxx.xxx.xxx.xxx...
* Connected to mysite.sharepoint.com (13.107.136.9) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none
* SSL connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate:
* subject: CN=*.sharepoint.com,OU=Microsoft Corporation,O=Microsoft Corporation,L=Redmond,ST=WA,C=US
* start date: Mar 07 21:35:03 2018 GMT
* expire date: Mar 06 21:35:03 2020 GMT
* common name: *.sharepoint.com
* issuer: CN=Microsoft IT TLS CA 1,OU=Microsoft IT,O=Microsoft Corporation,L=Redmond,ST=Washington,C=US
* Server auth using NTLM with user 'domain/username'
> PUT /sites/testwebhook/Shared-Documents/General/failed.csv HTTP/1.1
> Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=
> User-Agent: curl/7.29.0
> Host: mysite.sharepoint.com
> Accept: */*
> Content-Length: 0
> Expect: 100-continue
>
< HTTP/1.1 401 Unauthorized
< P3P: CP="ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI"
< SPRequestGuid: 4786a49e-803d-0000-38b8-19cb846bfe9d
< request-id: 4786a49e-803d-0000-38b8-19cb846bfe9d
< MS-CV: nqSGRz2AAAA4uBnLhGv+nQ.0
< Strict-Transport-Security: max-age=31536000
< X-FRAME-OPTIONS: SAMEORIGIN
< SPRequestDuration: 65
< SPIisLatency: 2
< X-Powered-By: ASP.NET
< MicrosoftSharePointTeamServices: 16.0.0.8314
< X-Content-Type-Options: nosniff
< X-MS-InvokeApp: 1; RequireReadOnly
< X-MSEdge-Ref: Ref A: 5387A1C54284471AA82105ED1FBDC2B1 Ref B: LON21EDGE1107 Ref C: 2018-11-21T12:21:13Z
< Date: Wed, 21 Nov 2018 12:21:12 GMT
< Content-Length: 0
<
* Connection #0 to host mysite.sharepoint.com left intact









share|improve this question


























    up vote
    -1
    down vote

    favorite












    I have been trying to upload a file to our SharePoint server for a couple of weeks with no success.



    I need to be able to send the file from a Linux server and get it into Microsoft teams. To achieve this I am been trying to send the file to SharePoint via Curl.



    I have read several post on here and elsewhere but I cannot see to get it to work.



    These are the commands I have been trying with the outputs. Please, can someone tell me where I am going wrong?



    curl -L -A "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0" -O --user domain/username:password -T failed.csv https://mysite.sharepoint.com/sites/testwebhook/Shared%20Documents/General/failed.csv -vvv


    % Total % Received % Xferd Average Speed Time Time Time Current
    Dload Upload Total Spent Left Speed
    0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* About to connect() to mysite.sharepoint.com port 443 (#0)
    * Trying xxx.xxx.xxx.xxx...
    * Connected to mysite.sharepoint.com (xxx.xxx.xxx.xxx) port 443 (#0)
    * Initializing NSS with certpath: sql:/etc/pki/nssdb
    * CAfile: /etc/pki/tls/certs/ca-bundle.crt
    CApath: none
    * SSL connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
    * Server certificate:
    * subject: CN=*.sharepoint.com,OU=Microsoft Corporation,O=Microsoft Corporation,L=Redmond,ST=WA,C=US
    * start date: Mar 07 21:35:03 2018 GMT
    * expire date: Mar 06 21:35:03 2020 GMT
    * common name: *.sharepoint.com
    * issuer: CN=Microsoft IT TLS CA 1,OU=Microsoft IT,O=Microsoft Corporation,L=Redmond,ST=Washington,C=US
    * Server auth using Basic with user 'domain/username'
    > PUT /sites/testwebhook/Shared%20Documents/General/failed.csv HTTP/1.1
    > Authorization: Basic c3BvcnRwZXNhLmNvbS9waGlsLmJyYWR5QDp6R0FWYnRmN2Y2Z1FjbEJFdG9Udw==
    > User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0
    > Host: mysite.sharepoint.com
    > Accept: */*
    > Content-Length: 1633
    > Expect: 100-continue
    >
    < HTTP/1.1 100 Continue
    } [data not shown]
    * We are completely uploaded and fine
    < HTTP/1.1 302 Found
    < Content-Length: 272
    < Content-Type: text/html; charset=utf-8
    < Location: https://mysite.sharepoint.com/sites/testwebhook/_layouts/15/Authenticate.aspx?Source=%2Fsites%2Ftestwebhook%2FShared%20Documents%2FGeneral%2Ffailed%2Ecsv
    < P3P: CP="ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI"
    < X-SharePointHealthScore: 2
    < SPRequestGuid: fa84a49e-e046-0000-38b8-14009af2f9eb
    < request-id: fa84a49e-e046-0000-38b8-14009af2f9eb
    < MS-CV: nqSE+kbgAAA4uBQAmvL56w.0
    < X-Powered-By: ASP.NET
    < MicrosoftSharePointTeamServices: 16.0.0.8314
    < X-Content-Type-Options: nosniff
    < X-MS-InvokeApp: 1; RequireReadOnly
    < X-MSEdge-Ref: Ref A: 60B7BACBCB0F48ADB6510D0754726C3E Ref B: LON21EDGE0609 Ref C: 2018-11-21T11:58:29Z
    < Date: Wed, 21 Nov 2018 11:58:29 GMT
    <
    * Ignoring the response-body
    { [data not shown]
    100 1905 100 272 100 1633 940 5644 --:--:-- --:--:-- --:--:-- 5650
    * Connection #0 to host mysite.sharepoint.com left intact
    * Issue another request to this URL: 'https://mysite.sharepoint.com/sites/testwebhook/_layouts/15/Authenticate.aspx?Source=%2Fsites%2Ftestwebhook%2FShared%20Documents%2FGeneral%2Ffailed%2Ecsv'
    * Found bundle for host mysite.sharepoint.com: 0x11eb340
    * Re-using existing connection! (#0) with host mysite.sharepoint.com
    * Connected to mysite.sharepoint.com (xxx.xxx.xxx.xxx) port 443 (#0)
    * Server auth using Basic with user 'domain:'
    > PUT /sites/testwebhook/_layouts/15/Authenticate.aspx?Source=%2Fsites%2Ftestwebhook%2FShared%20Documents%2FGeneral%2Ffailed%2Ecsv HTTP/1.1
    > Authorization: Basic c3BvcnRwZXNhLmNvbS9waGlsLmJyYWR5QDp6R0FWYnRmN2Y2Z1FjbEJFdG9Udw==
    > User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0
    > Host: mysite.sharepoint.com
    > Accept: */*
    > Content-Length: 1633
    > Expect: 100-continue
    >
    < HTTP/1.1 100 Continue
    } [data not shown]
    * We are completely uploaded and fine
    < HTTP/1.1 405 Method Not Allowed
    < Allow: GET, HEAD, OPTIONS, TRACE
    < P3P: CP="ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI"
    < X-SharePointHealthScore: 2
    < SPRequestGuid: fa84a49e-f044-0000-38b8-1bd5894edf98
    < request-id: fa84a49e-f044-0000-38b8-1bd5894edf98
    < MS-CV: nqSE+kTwAAA4uBvViU7fmA.0
    < Strict-Transport-Security: max-age=31536000
    < X-FRAME-OPTIONS: SAMEORIGIN
    < SPRequestDuration: 15
    < SPIisLatency: 2
    < X-Powered-By: ASP.NET
    < MicrosoftSharePointTeamServices: 16.0.0.8314
    < X-Content-Type-Options: nosniff
    < X-MS-InvokeApp: 1; RequireReadOnly
    < X-MSEdge-Ref: Ref A: 3DB34D91446A4556978DF6B7BABD5907 Ref B: LON21EDGE0609 Ref C: 2018-11-21T11:58:29Z
    < Date: Wed, 21 Nov 2018 11:58:29 GMT
    < Content-Length: 0
    <
    100 1633 0 0 100 1633 0 4842 --:--:-- --:--:-- --:--:-- 4842
    * Connection #0 to host mysite.sharepoint.com left intact


    AND



    curl --ntlm --user domain/username:password -T failed.csv https://mysite.sharepoint.com/sites/testwebhook/Shared-Documents/General/failed.csv -vvv
    * About to connect() to mysite.sharepoint.com port 443 (#0)
    * Trying xxx.xxx.xxx.xxx...
    * Connected to mysite.sharepoint.com (13.107.136.9) port 443 (#0)
    * Initializing NSS with certpath: sql:/etc/pki/nssdb
    * CAfile: /etc/pki/tls/certs/ca-bundle.crt
    CApath: none
    * SSL connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
    * Server certificate:
    * subject: CN=*.sharepoint.com,OU=Microsoft Corporation,O=Microsoft Corporation,L=Redmond,ST=WA,C=US
    * start date: Mar 07 21:35:03 2018 GMT
    * expire date: Mar 06 21:35:03 2020 GMT
    * common name: *.sharepoint.com
    * issuer: CN=Microsoft IT TLS CA 1,OU=Microsoft IT,O=Microsoft Corporation,L=Redmond,ST=Washington,C=US
    * Server auth using NTLM with user 'domain/username'
    > PUT /sites/testwebhook/Shared-Documents/General/failed.csv HTTP/1.1
    > Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=
    > User-Agent: curl/7.29.0
    > Host: mysite.sharepoint.com
    > Accept: */*
    > Content-Length: 0
    > Expect: 100-continue
    >
    < HTTP/1.1 401 Unauthorized
    < P3P: CP="ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI"
    < SPRequestGuid: 4786a49e-803d-0000-38b8-19cb846bfe9d
    < request-id: 4786a49e-803d-0000-38b8-19cb846bfe9d
    < MS-CV: nqSGRz2AAAA4uBnLhGv+nQ.0
    < Strict-Transport-Security: max-age=31536000
    < X-FRAME-OPTIONS: SAMEORIGIN
    < SPRequestDuration: 65
    < SPIisLatency: 2
    < X-Powered-By: ASP.NET
    < MicrosoftSharePointTeamServices: 16.0.0.8314
    < X-Content-Type-Options: nosniff
    < X-MS-InvokeApp: 1; RequireReadOnly
    < X-MSEdge-Ref: Ref A: 5387A1C54284471AA82105ED1FBDC2B1 Ref B: LON21EDGE1107 Ref C: 2018-11-21T12:21:13Z
    < Date: Wed, 21 Nov 2018 12:21:12 GMT
    < Content-Length: 0
    <
    * Connection #0 to host mysite.sharepoint.com left intact









    share|improve this question
























      up vote
      -1
      down vote

      favorite









      up vote
      -1
      down vote

      favorite











      I have been trying to upload a file to our SharePoint server for a couple of weeks with no success.



      I need to be able to send the file from a Linux server and get it into Microsoft teams. To achieve this I am been trying to send the file to SharePoint via Curl.



      I have read several post on here and elsewhere but I cannot see to get it to work.



      These are the commands I have been trying with the outputs. Please, can someone tell me where I am going wrong?



      curl -L -A "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0" -O --user domain/username:password -T failed.csv https://mysite.sharepoint.com/sites/testwebhook/Shared%20Documents/General/failed.csv -vvv


      % Total % Received % Xferd Average Speed Time Time Time Current
      Dload Upload Total Spent Left Speed
      0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* About to connect() to mysite.sharepoint.com port 443 (#0)
      * Trying xxx.xxx.xxx.xxx...
      * Connected to mysite.sharepoint.com (xxx.xxx.xxx.xxx) port 443 (#0)
      * Initializing NSS with certpath: sql:/etc/pki/nssdb
      * CAfile: /etc/pki/tls/certs/ca-bundle.crt
      CApath: none
      * SSL connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
      * Server certificate:
      * subject: CN=*.sharepoint.com,OU=Microsoft Corporation,O=Microsoft Corporation,L=Redmond,ST=WA,C=US
      * start date: Mar 07 21:35:03 2018 GMT
      * expire date: Mar 06 21:35:03 2020 GMT
      * common name: *.sharepoint.com
      * issuer: CN=Microsoft IT TLS CA 1,OU=Microsoft IT,O=Microsoft Corporation,L=Redmond,ST=Washington,C=US
      * Server auth using Basic with user 'domain/username'
      > PUT /sites/testwebhook/Shared%20Documents/General/failed.csv HTTP/1.1
      > Authorization: Basic c3BvcnRwZXNhLmNvbS9waGlsLmJyYWR5QDp6R0FWYnRmN2Y2Z1FjbEJFdG9Udw==
      > User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0
      > Host: mysite.sharepoint.com
      > Accept: */*
      > Content-Length: 1633
      > Expect: 100-continue
      >
      < HTTP/1.1 100 Continue
      } [data not shown]
      * We are completely uploaded and fine
      < HTTP/1.1 302 Found
      < Content-Length: 272
      < Content-Type: text/html; charset=utf-8
      < Location: https://mysite.sharepoint.com/sites/testwebhook/_layouts/15/Authenticate.aspx?Source=%2Fsites%2Ftestwebhook%2FShared%20Documents%2FGeneral%2Ffailed%2Ecsv
      < P3P: CP="ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI"
      < X-SharePointHealthScore: 2
      < SPRequestGuid: fa84a49e-e046-0000-38b8-14009af2f9eb
      < request-id: fa84a49e-e046-0000-38b8-14009af2f9eb
      < MS-CV: nqSE+kbgAAA4uBQAmvL56w.0
      < X-Powered-By: ASP.NET
      < MicrosoftSharePointTeamServices: 16.0.0.8314
      < X-Content-Type-Options: nosniff
      < X-MS-InvokeApp: 1; RequireReadOnly
      < X-MSEdge-Ref: Ref A: 60B7BACBCB0F48ADB6510D0754726C3E Ref B: LON21EDGE0609 Ref C: 2018-11-21T11:58:29Z
      < Date: Wed, 21 Nov 2018 11:58:29 GMT
      <
      * Ignoring the response-body
      { [data not shown]
      100 1905 100 272 100 1633 940 5644 --:--:-- --:--:-- --:--:-- 5650
      * Connection #0 to host mysite.sharepoint.com left intact
      * Issue another request to this URL: 'https://mysite.sharepoint.com/sites/testwebhook/_layouts/15/Authenticate.aspx?Source=%2Fsites%2Ftestwebhook%2FShared%20Documents%2FGeneral%2Ffailed%2Ecsv'
      * Found bundle for host mysite.sharepoint.com: 0x11eb340
      * Re-using existing connection! (#0) with host mysite.sharepoint.com
      * Connected to mysite.sharepoint.com (xxx.xxx.xxx.xxx) port 443 (#0)
      * Server auth using Basic with user 'domain:'
      > PUT /sites/testwebhook/_layouts/15/Authenticate.aspx?Source=%2Fsites%2Ftestwebhook%2FShared%20Documents%2FGeneral%2Ffailed%2Ecsv HTTP/1.1
      > Authorization: Basic c3BvcnRwZXNhLmNvbS9waGlsLmJyYWR5QDp6R0FWYnRmN2Y2Z1FjbEJFdG9Udw==
      > User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0
      > Host: mysite.sharepoint.com
      > Accept: */*
      > Content-Length: 1633
      > Expect: 100-continue
      >
      < HTTP/1.1 100 Continue
      } [data not shown]
      * We are completely uploaded and fine
      < HTTP/1.1 405 Method Not Allowed
      < Allow: GET, HEAD, OPTIONS, TRACE
      < P3P: CP="ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI"
      < X-SharePointHealthScore: 2
      < SPRequestGuid: fa84a49e-f044-0000-38b8-1bd5894edf98
      < request-id: fa84a49e-f044-0000-38b8-1bd5894edf98
      < MS-CV: nqSE+kTwAAA4uBvViU7fmA.0
      < Strict-Transport-Security: max-age=31536000
      < X-FRAME-OPTIONS: SAMEORIGIN
      < SPRequestDuration: 15
      < SPIisLatency: 2
      < X-Powered-By: ASP.NET
      < MicrosoftSharePointTeamServices: 16.0.0.8314
      < X-Content-Type-Options: nosniff
      < X-MS-InvokeApp: 1; RequireReadOnly
      < X-MSEdge-Ref: Ref A: 3DB34D91446A4556978DF6B7BABD5907 Ref B: LON21EDGE0609 Ref C: 2018-11-21T11:58:29Z
      < Date: Wed, 21 Nov 2018 11:58:29 GMT
      < Content-Length: 0
      <
      100 1633 0 0 100 1633 0 4842 --:--:-- --:--:-- --:--:-- 4842
      * Connection #0 to host mysite.sharepoint.com left intact


      AND



      curl --ntlm --user domain/username:password -T failed.csv https://mysite.sharepoint.com/sites/testwebhook/Shared-Documents/General/failed.csv -vvv
      * About to connect() to mysite.sharepoint.com port 443 (#0)
      * Trying xxx.xxx.xxx.xxx...
      * Connected to mysite.sharepoint.com (13.107.136.9) port 443 (#0)
      * Initializing NSS with certpath: sql:/etc/pki/nssdb
      * CAfile: /etc/pki/tls/certs/ca-bundle.crt
      CApath: none
      * SSL connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
      * Server certificate:
      * subject: CN=*.sharepoint.com,OU=Microsoft Corporation,O=Microsoft Corporation,L=Redmond,ST=WA,C=US
      * start date: Mar 07 21:35:03 2018 GMT
      * expire date: Mar 06 21:35:03 2020 GMT
      * common name: *.sharepoint.com
      * issuer: CN=Microsoft IT TLS CA 1,OU=Microsoft IT,O=Microsoft Corporation,L=Redmond,ST=Washington,C=US
      * Server auth using NTLM with user 'domain/username'
      > PUT /sites/testwebhook/Shared-Documents/General/failed.csv HTTP/1.1
      > Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=
      > User-Agent: curl/7.29.0
      > Host: mysite.sharepoint.com
      > Accept: */*
      > Content-Length: 0
      > Expect: 100-continue
      >
      < HTTP/1.1 401 Unauthorized
      < P3P: CP="ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI"
      < SPRequestGuid: 4786a49e-803d-0000-38b8-19cb846bfe9d
      < request-id: 4786a49e-803d-0000-38b8-19cb846bfe9d
      < MS-CV: nqSGRz2AAAA4uBnLhGv+nQ.0
      < Strict-Transport-Security: max-age=31536000
      < X-FRAME-OPTIONS: SAMEORIGIN
      < SPRequestDuration: 65
      < SPIisLatency: 2
      < X-Powered-By: ASP.NET
      < MicrosoftSharePointTeamServices: 16.0.0.8314
      < X-Content-Type-Options: nosniff
      < X-MS-InvokeApp: 1; RequireReadOnly
      < X-MSEdge-Ref: Ref A: 5387A1C54284471AA82105ED1FBDC2B1 Ref B: LON21EDGE1107 Ref C: 2018-11-21T12:21:13Z
      < Date: Wed, 21 Nov 2018 12:21:12 GMT
      < Content-Length: 0
      <
      * Connection #0 to host mysite.sharepoint.com left intact









      share|improve this question













      I have been trying to upload a file to our SharePoint server for a couple of weeks with no success.



      I need to be able to send the file from a Linux server and get it into Microsoft teams. To achieve this I am been trying to send the file to SharePoint via Curl.



      I have read several post on here and elsewhere but I cannot see to get it to work.



      These are the commands I have been trying with the outputs. Please, can someone tell me where I am going wrong?



      curl -L -A "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0" -O --user domain/username:password -T failed.csv https://mysite.sharepoint.com/sites/testwebhook/Shared%20Documents/General/failed.csv -vvv


      % Total % Received % Xferd Average Speed Time Time Time Current
      Dload Upload Total Spent Left Speed
      0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* About to connect() to mysite.sharepoint.com port 443 (#0)
      * Trying xxx.xxx.xxx.xxx...
      * Connected to mysite.sharepoint.com (xxx.xxx.xxx.xxx) port 443 (#0)
      * Initializing NSS with certpath: sql:/etc/pki/nssdb
      * CAfile: /etc/pki/tls/certs/ca-bundle.crt
      CApath: none
      * SSL connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
      * Server certificate:
      * subject: CN=*.sharepoint.com,OU=Microsoft Corporation,O=Microsoft Corporation,L=Redmond,ST=WA,C=US
      * start date: Mar 07 21:35:03 2018 GMT
      * expire date: Mar 06 21:35:03 2020 GMT
      * common name: *.sharepoint.com
      * issuer: CN=Microsoft IT TLS CA 1,OU=Microsoft IT,O=Microsoft Corporation,L=Redmond,ST=Washington,C=US
      * Server auth using Basic with user 'domain/username'
      > PUT /sites/testwebhook/Shared%20Documents/General/failed.csv HTTP/1.1
      > Authorization: Basic c3BvcnRwZXNhLmNvbS9waGlsLmJyYWR5QDp6R0FWYnRmN2Y2Z1FjbEJFdG9Udw==
      > User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0
      > Host: mysite.sharepoint.com
      > Accept: */*
      > Content-Length: 1633
      > Expect: 100-continue
      >
      < HTTP/1.1 100 Continue
      } [data not shown]
      * We are completely uploaded and fine
      < HTTP/1.1 302 Found
      < Content-Length: 272
      < Content-Type: text/html; charset=utf-8
      < Location: https://mysite.sharepoint.com/sites/testwebhook/_layouts/15/Authenticate.aspx?Source=%2Fsites%2Ftestwebhook%2FShared%20Documents%2FGeneral%2Ffailed%2Ecsv
      < P3P: CP="ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI"
      < X-SharePointHealthScore: 2
      < SPRequestGuid: fa84a49e-e046-0000-38b8-14009af2f9eb
      < request-id: fa84a49e-e046-0000-38b8-14009af2f9eb
      < MS-CV: nqSE+kbgAAA4uBQAmvL56w.0
      < X-Powered-By: ASP.NET
      < MicrosoftSharePointTeamServices: 16.0.0.8314
      < X-Content-Type-Options: nosniff
      < X-MS-InvokeApp: 1; RequireReadOnly
      < X-MSEdge-Ref: Ref A: 60B7BACBCB0F48ADB6510D0754726C3E Ref B: LON21EDGE0609 Ref C: 2018-11-21T11:58:29Z
      < Date: Wed, 21 Nov 2018 11:58:29 GMT
      <
      * Ignoring the response-body
      { [data not shown]
      100 1905 100 272 100 1633 940 5644 --:--:-- --:--:-- --:--:-- 5650
      * Connection #0 to host mysite.sharepoint.com left intact
      * Issue another request to this URL: 'https://mysite.sharepoint.com/sites/testwebhook/_layouts/15/Authenticate.aspx?Source=%2Fsites%2Ftestwebhook%2FShared%20Documents%2FGeneral%2Ffailed%2Ecsv'
      * Found bundle for host mysite.sharepoint.com: 0x11eb340
      * Re-using existing connection! (#0) with host mysite.sharepoint.com
      * Connected to mysite.sharepoint.com (xxx.xxx.xxx.xxx) port 443 (#0)
      * Server auth using Basic with user 'domain:'
      > PUT /sites/testwebhook/_layouts/15/Authenticate.aspx?Source=%2Fsites%2Ftestwebhook%2FShared%20Documents%2FGeneral%2Ffailed%2Ecsv HTTP/1.1
      > Authorization: Basic c3BvcnRwZXNhLmNvbS9waGlsLmJyYWR5QDp6R0FWYnRmN2Y2Z1FjbEJFdG9Udw==
      > User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0
      > Host: mysite.sharepoint.com
      > Accept: */*
      > Content-Length: 1633
      > Expect: 100-continue
      >
      < HTTP/1.1 100 Continue
      } [data not shown]
      * We are completely uploaded and fine
      < HTTP/1.1 405 Method Not Allowed
      < Allow: GET, HEAD, OPTIONS, TRACE
      < P3P: CP="ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI"
      < X-SharePointHealthScore: 2
      < SPRequestGuid: fa84a49e-f044-0000-38b8-1bd5894edf98
      < request-id: fa84a49e-f044-0000-38b8-1bd5894edf98
      < MS-CV: nqSE+kTwAAA4uBvViU7fmA.0
      < Strict-Transport-Security: max-age=31536000
      < X-FRAME-OPTIONS: SAMEORIGIN
      < SPRequestDuration: 15
      < SPIisLatency: 2
      < X-Powered-By: ASP.NET
      < MicrosoftSharePointTeamServices: 16.0.0.8314
      < X-Content-Type-Options: nosniff
      < X-MS-InvokeApp: 1; RequireReadOnly
      < X-MSEdge-Ref: Ref A: 3DB34D91446A4556978DF6B7BABD5907 Ref B: LON21EDGE0609 Ref C: 2018-11-21T11:58:29Z
      < Date: Wed, 21 Nov 2018 11:58:29 GMT
      < Content-Length: 0
      <
      100 1633 0 0 100 1633 0 4842 --:--:-- --:--:-- --:--:-- 4842
      * Connection #0 to host mysite.sharepoint.com left intact


      AND



      curl --ntlm --user domain/username:password -T failed.csv https://mysite.sharepoint.com/sites/testwebhook/Shared-Documents/General/failed.csv -vvv
      * About to connect() to mysite.sharepoint.com port 443 (#0)
      * Trying xxx.xxx.xxx.xxx...
      * Connected to mysite.sharepoint.com (13.107.136.9) port 443 (#0)
      * Initializing NSS with certpath: sql:/etc/pki/nssdb
      * CAfile: /etc/pki/tls/certs/ca-bundle.crt
      CApath: none
      * SSL connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
      * Server certificate:
      * subject: CN=*.sharepoint.com,OU=Microsoft Corporation,O=Microsoft Corporation,L=Redmond,ST=WA,C=US
      * start date: Mar 07 21:35:03 2018 GMT
      * expire date: Mar 06 21:35:03 2020 GMT
      * common name: *.sharepoint.com
      * issuer: CN=Microsoft IT TLS CA 1,OU=Microsoft IT,O=Microsoft Corporation,L=Redmond,ST=Washington,C=US
      * Server auth using NTLM with user 'domain/username'
      > PUT /sites/testwebhook/Shared-Documents/General/failed.csv HTTP/1.1
      > Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=
      > User-Agent: curl/7.29.0
      > Host: mysite.sharepoint.com
      > Accept: */*
      > Content-Length: 0
      > Expect: 100-continue
      >
      < HTTP/1.1 401 Unauthorized
      < P3P: CP="ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI"
      < SPRequestGuid: 4786a49e-803d-0000-38b8-19cb846bfe9d
      < request-id: 4786a49e-803d-0000-38b8-19cb846bfe9d
      < MS-CV: nqSGRz2AAAA4uBnLhGv+nQ.0
      < Strict-Transport-Security: max-age=31536000
      < X-FRAME-OPTIONS: SAMEORIGIN
      < SPRequestDuration: 65
      < SPIisLatency: 2
      < X-Powered-By: ASP.NET
      < MicrosoftSharePointTeamServices: 16.0.0.8314
      < X-Content-Type-Options: nosniff
      < X-MS-InvokeApp: 1; RequireReadOnly
      < X-MSEdge-Ref: Ref A: 5387A1C54284471AA82105ED1FBDC2B1 Ref B: LON21EDGE1107 Ref C: 2018-11-21T12:21:13Z
      < Date: Wed, 21 Nov 2018 12:21:12 GMT
      < Content-Length: 0
      <
      * Connection #0 to host mysite.sharepoint.com left intact






      curl sharepoint






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 21 at 15:18









      Ydrab

      1




      1





























          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53415192%2fupload-file-to-sharepoint-via-curl%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53415192%2fupload-file-to-sharepoint-via-curl%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

          Calculate evaluation metrics using cross_val_predict sklearn

          Insert data from modal to MySQL (multiple modal on website)