如何自动上传和签入文件到sharepoint使用curl? [英] How to auto upload and check in the files to sharepoint using curl?

查看:718
本文介绍了如何自动上传和签入文件到sharepoint使用curl?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用我的共享点登录凭据将文件从linux上传到sharepoint。
我使用cURL实用程序来实现这一点。

I am trying to upload a file from linux to sharepoint with my sharepoint login credentials. I use the cURL utility to achieve this. The upload is successful.

使用的命令是: curl --ntlm --user username:password --upload-file myfile.txt - k https://sharepointserver.com/sites/mysite/myfile.txt
-k选项用于克服非安全共享点站点的证书错误。

The command used is : curl --ntlm --user username:password --upload-file myfile.txt -k https://sharepointserver.com/sites/mysite/myfile.txt -k option is used to overcome the certificate errors for the non-secure sharepoint site.

但是,此上传的文件显示在我的登录的sharepoint中的签出视图(绿色箭头)。
因此,此文件对于来自其他登录的用户不存在。

However, this uploaded file is showing up in "checked out" view(green arrow) in sharepoint from my login. As a result, this file is non-existent for users from other logins.

我的登录名具有对sharepoint的写访问权限。

My login has the write access previlege to sharepoint.

有关如何签入此文件以与cURL共享点的任何想法,以便可以从任何人的登录信息查看该文件?

Any ideas on how to "check in" this file to sharepoint with cURL so that the file can be viewed from anyone's login ?

推荐答案

我现在没有curl可以测试,但你可以从以下信息中选择一些东西。

I don't have curl available to test right now but you might be able to fashion something out of the following information.

签入和签出由/_layouts/CheckIn.aspx

Check in and check out is handled by /_layouts/CheckIn.aspx

页面具有以下查询字符串变量:

The page has the following querystring variables:

列表 - 标识当前列表的GUID。

List - A GUID that identifies the current list.

FileName

- 图书馆中allitems.aspx页面的完整网址。

Source - The full url to the allitems.aspx page in the library.

我能够使用FileName和Source参数并省略List参数来获取CheckIn.aspx页面。这是很好的,因为你不必找出一个方法来查找列表GUID。

I was able to get the CheckIn.aspx page to load correctly just using the FileName and Source parameters and omitting the List parameter. This is good because you don't have to figure out a way to look up the List GUID.

CheckIn.aspx页面回发到自己与以下表单参数控制检入:

The CheckIn.aspx page postbacks to itself with the following form parameters that control checkin:

PostBack - 布尔值设置为true。

PostBack - boolean set to true.

CheckInAction - 设置为ActionCheckin的字符串

CheckInAction - string set to ActionCheckin

KeepCheckout - 设置为1以保持结帐,

CheckinDescription - 字符串

KeepCheckout - set to 1 to keep checkout and 0 to keep checked in

以卷曲形式调用

curl --dataPostBack = true& CheckinAction = ActionCheckin& KeepCheckout = 0& CheckinDescription = SomeTextForCheckInhttp:// {您的服务器和网站} checkin.aspx?Source = {Full Url To Library} /Forms/AllItems.aspx&FileName= {Doc And Ext}

Call this in curl like so

说我没有卷曲测试,但我有这个工作使用Fiddler 2中的Composer选项卡

curl --data "PostBack=true&CheckinAction=ActionCheckin&KeepCheckout=0&CheckinDescription=SomeTextForCheckIn" http://{Your Server And Site}/_layouts/checkin.aspx?Source={Full Url To Library}/Forms/AllItems.aspx&FileName={Doc And Ext}

我现在尝试这个curl和有一个问题使它工作。 Fiddler作为POST执行请求。如果您尝试这样做作为一个GET请求,您会得到一个500错误,说,PermWeWardafeUpdates属性的SPWeb不会允许这个请求通过GET。

As I said I don't have curl to test but I got this to work using the Composer tab in Fiddler 2

这篇关于如何自动上传和签入文件到sharepoint使用curl?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆