curl을 사용하여 공유 지점에 파일을 업로드하려고합니다. (. 즉, 파일을 체크 아웃을 업로드하고 다시 그것을 확인하는 컬의 3 별도의 호출) 나는 다음과 같은 게시물에 제안을 사용하여, 세 단계에서 성공적으로이 작업을 수행 할 수 있습니다다른 옵션으로 컬을 사용하여 여러 요청 수행
How to check-out a file from sharepoint document library using curl?
내
# Checkout the index.html file
curl --ntlm --user ${USER} \
--data @- \
-H "SOAPAction: http://schemas.microsoft.com/sharepoint/soap/CheckOutFile" \
-H "Content-Type: text/xml; charset=utf-8" \
${SHAREPOINT}/_vti_bin/Lists.asmx << EOF
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<CheckOutFile xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<pageUrl>${FILE}</pageUrl>
<checkoutToLocal>false</checkoutToLocal>
<lastmodified/>
</CheckOutFile>
</soap:Body>
</soap:Envelope>
EOF
# upload the file
curl --ntlm -u ${USER} \
-T HTML/2015/index.html \
${FOLDER}
curl --ntlm --user ${USER} \
--data @- \
-H "SOAPAction: http://schemas.microsoft.com/sharepoint/soap/CheckInFile" \
-H "Content-Type: text/xml; charset=utf-8" \
${SHAREPOINT}/_vti_bin/Lists.asmx << EOF
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<CheckInFile xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<pageUrl>${FILE}</pageUrl>
<comment>Automagic update</comment>
<checkinType>0</checkinType>
</CheckInFile>
</soap:Body>
</soap:Envelope>
EOF
불행하게도,이 내 암호를 세 번 나 한테 물어 컬 결과 : 같은 개별 요청 보일 (그리고 긴 암호입니다 :-)!). 나는 또한 .netrc 파일에 대한 생각을 좋아하지 않는다. 왜냐하면 디스크에 암호를 쓰는 것은 좋은 생각이 아니기 때문이다.
그럼, 내가 할 수있을 거라고 생각하는 등, 설정하고 필요에 따라 헤더를 삭제, bash는 프로세스 대체를 사용하여 적절하게 요청 몸을 공급, 단일 명령 줄에 모든 요청을 결합
입니다curl --ntlm --user ${USER} \
--trace-ascii publish.log \
--data @<(echo "$CHECKOUT") \
-H "SOAPAction: http://schemas.microsoft.com/sharepoint/soap/CheckOutFile" \
-H "Content-Type: text/xml; charset=utf-8" \
${SHAREPOINT}/_vti_bin/Lists.asmx \
-H "SOAPAction:" \
-H "Content-Type:" \
-T HTML/2015/index.html \
${FOLDER} \
--data @<(echo "$CHECKIN") \
-H "SOAPAction: http://schemas.microsoft.com/sharepoint/soap/CheckInFile" \
-H "Content-Type: text/xml; charset=utf-8" \
${SHAREPOINT}/_vti_bin/Lists.asmx
불행히도, cUrl은 모든 옵션을 한 번에 처리 한 다음 URL 요청을 시도하여 하나의 URL에 대한 옵션이 다른 URL에 대한 옵션을 덮어 쓰고 궁극적으로 아무런 효과가없는 것으로 보입니다. 로그 파일에서 미리보기 :
> 0000: PUT /xxx/xxx/_vti_bin/Lists.asmx HTTP/1.1
> 0033: Authorization: NTLM AAAAAAAAAAA=
> 0075: User-Agent: curl/7.30.0
> 008e: Host: example.com
> 00a8: Accept: */*
> 00b5: SOAPAction: http://schemas.microsoft.com/sharepoint/soap/CheckOu
> 00f5: tFile
> 00fc: Content-Type: text/xml; charset=utf-8
> 0123: SOAPAction: http://schemas.microsoft.com/sharepoint/soap/CheckIn
> 0163: File
> 0169: Content-Type: text/xml; charset=utf-8
> 0190: Content-Length: 0
> 01a3: Expect: 100-continue
공지 중복의 SOAPAction 헤더, 난 단지 적용되는 첫 번째 옵션이 기대하는 동안.
"지금 처리 옵션을 중지하고이 URL을 수행 한 다음 계속하십시오"라고 말할 수있는 방법이 있습니까?
암호 만 입력하면 암호를 묻는 메시지가 나타나고 변수에서 읽고 다음과 같이 말풍선 명령으로 사용할 수 있습니다. –
제안에 감사드립니다. 유감스럽게도 "ps"및 "top"등의 명령 결과에 명령 줄 인수가 표시되어 해당 기술을 사용하는 모든 사람의 암호가 노출 될 수 있습니다. –