我应该为Share Point查找列(FacilityIDid)赋予什么值。我试过给出值和ID; #ColumnValue。他们似乎都没有为我工作
这是我到目前为止所尝试的内容
curl --ntlm -d " {PersonnelID:'2810', FirstName:'Seth', LastName:'Yoser', **FacilityIDId**:'2810;#246'}" -H content-type:application/json -H If-Mat
ch:* -X PUT http://user:pass@server/sites/eTMFDev/_vti_bi
n/ListData.svc/FacilityPersonnel(2810) -v
这是我得到的错误
* Trying 10.108.50.173...
* Connected to server (10.108.50.173) port 80 (#0)
* Server auth using NTLM with user 'xxxxxxx'
> PUT /sites/eTMFDev/_vti_bin/ListData.svc/FacilityPersonnel(2810) HTTP/1.1
> Authorization: NTLM TlRMTVNTUAABAAAAt4II4gAAAAAAAAAAAAAAAAAAAAAGAbEdAAAADw==
> User-Agent: curl/7.35.0
> Host: server
> Accept: */*
> content-type:application/json
> If-Match:*
> Content-Length: 0
>
< HTTP/1.1 401 Unauthorized
* Server Microsoft-IIS/7.5 is not blacklisted
< Server: Microsoft-IIS/7.5
< SPRequestGuid: 0914fefe-5485-4113-a5f5-8e97257e844a
< WWW-Authenticate: NTLM TlRMTVNTUAACAAAAEgASADgAAAA1goniWVuIi/bRlnsAAAAAAAAAALw
AvABKAAAABgGxHQAAAA9SAEUARwBFAE4ARQBSAE8ATgACABIAUgBFAEcARQBOAEUAUgBPAE4AAQAWAFQ
AQQBSAFIARQBHAFMAUAAwADMARAAEACQAcgBlAGcAZQBuAGUAcgBvAG4ALgByAGUAZwBuAC4AYwBvAG0
AAwA8AFQAQQBSAFIARQBHAFMAUAAwADMARAAuAHIAZQBnAGUAbgBlAHIAbwBuAC4AcgBlAGcAbgAuAGM
AbwBtAAUAEAByAGUAZwBuAC4AYwBvAG0ABwAIADoscir1Qs8BAAAAAA==
< X-Powered-By: ASP.NET
< MicrosoftSharePointTeamServices: 14.0.0.6112
< Date: Tue, 18 Mar 2014 21:58:16 GMT
< Content-Length: 0
<
* Connection #0 to host server left intact
* Issue another request to this URL: 'http://user:pass@server/sites/eTMFDev/_vti_bin/ListData.svc/FacilityPersonnel(2810)'
* Found bundle for host server: 0x6f56a8
* Re-using existing connection! (#0) with host tarregsp03d
* Connected to server (10.108.50.173) port 80 (#0)
* Server auth using NTLM with user 'xxxxxxxx'
> PUT /sites/eTMFDev/_vti_bin/ListData.svc/FacilityPersonnel(2810) HTTP/1.1
> Authorization: NTLM TlRMTVNTUAADAAAAGAAYAJIAAABEAUQBqgAAAAAAAABYAAAAJAAkAFgAAA
AWABYAfAAAABAAEADuAQAANYKI4gYBsR0AAAAPeKao8HTlrnu7E+9CmM0RMm4AYQB2AGUAZQBuAC4AbQ
BpAGsAawBpAGwAaQBuAGUAbgBpAE4ATQBJAEsASwBJAEwASQBFAE4ASQAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAOzIpEPva8qt67zJ9biezZAQEAAAAAAAA6LHIq9ULPAdv4PIEtOZT2AAAAAAIAEgBSAEUARw
BFAE4ARQBSAE8ATgABABYAVABBAFIAUgBFAEcAUwBQADAAMwBEAAQAJAByAGUAZwBlAG4AZQByAG8Abg
AuAHIAZQBnAG4ALgBjAG8AbQADADwAVABBAFIAUgBFAEcAUwBQADAAMwBEAC4AcgBlAGcAZQBuAGUAcg
BvAG4ALgByAGUAZwBuAC4AYwBvAG0ABQAQAHIAZQBnAG4ALgBjAG8AbQAHAAgAOixyKvVCzwEGAAQAAg
AAAAgAMAAwAAAAAAAAAAEAAAAAIAAA4WriUS7UHOe2wTpB8DNYuNHjFPfS1HGB7DSdPqeo0XwKABAAAA
AAAAAAAAAAAAAAAAAAAAkAAAAAAAAAAAAAAAAAAAAYZVx3VVlj4kc9H1z8LRKl
> User-Agent: curl/7.35.0
> Host: server
> Accept: */*
> content-type:application/json
> If-Match:*
> Content-Length: 81
>
* upload completely sent off: 81 out of 81 bytes
< HTTP/1.1 400 Bad Request
< Cache-Control: private
< Content-Type: application/xml
* Server Microsoft-IIS/7.5 is not blacklisted
< Server: Microsoft-IIS/7.5
< SPRequestGuid: 213d379e-9b8d-452c-9cab-57f7b1ec6b12
< Set-Cookie: WSS_KeepSessionAuthenticated={51c18e72-bc56-4ff9-a8a9-dd0cf0c85237
}; path=/
< X-SharePointHealthScore: 4
< DataServiceVersion: 1.0;
< X-AspNet-Version: 2.0.50727
< Persistent-Auth: true
< X-Powered-By: ASP.NET
< MicrosoftSharePointTeamServices: 14.0.0.6112
< Date: Tue, 18 Mar 2014 21:58:16 GMT
< Content-Length: 418
<
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<code></code>
<message xml:lang="en-US">Error processing request stream. Error encountered i
n converting the value from request payload for property 'FacilityIDId' to type
'Int32', which is the property's expected type. See inner exception for more det
ail.</message>
</error>* Connection #0 to host tarregsp03d left intact
以下是带有context-length参数的代码
C:\Users\nmikkilineni>curl --ntlm -d " {PersonnelID:'2810', FirstName:'Seth', La
stName:'Yoser', FacilityIDId:'#0247'}" -H content-type:application/json -H If-Ma
tch:* -H "Content-Length: 90" -X PUT http://naveen.mikkilineni:mar-2014@tarregsp
03d/sites/eTMFDev/_vti_bin/ListData.svc/FacilityPersonnel(2810) -v
* Hostname was NOT found in DNS cache
* Trying 10.108.50.173...
* Connected to tarregsp03d (10.108.50.173) port 80 (#0)
* Server auth using NTLM with user 'naveen.mikkilineni'
> PUT /sites/eTMFDev/_vti_bin/ListData.svc/FacilityPersonnel(2810) HTTP/1.1
> Authorization: NTLM TlRMTVNTUAABAAAAt4II4gAAAAAAAAAAAAAAAAAAAAAGAbEdAAAADw==
> User-Agent: curl/7.35.0
> Host: tarregsp03d
> Accept: */*
> content-type:application/json
> If-Match:*
>
< HTTP/1.1 411 Length Required
< Content-Type: text/html; charset=us-ascii
* Server Microsoft-HTTPAPI/2.0 is not blacklisted
< Server: Microsoft-HTTPAPI/2.0
< Date: Wed, 19 Mar 2014 00:19:44 GMT
< Connection: close
< Content-Length: 344
<
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/str
ict.dtd">
<HTML><HEAD><TITLE>Length Required</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Length Required</h2>
<hr><p>HTTP Error 411. The request must be chunked or have a content length.</p>
</BODY></HTML>
* Closing connection 0
答案 0 :(得分:0)
您的PUT
请求向服务器发送Content-Length: 0
数据。它需要PUT
来指定您发送的内容长度。
添加此标题
-H "Content-Length: xyz"
此处xyz是您通过-d
参数传递的字符串的总长度。在你的情况下,它的长度大约为86个字符!