我试图在Sharepoint列表中找到一些数据。
我有列表ID,使用列表服务" GetList"方法我可以看到我正在寻找的字段附加到列表中。当我尝试使用" GetListItems"这个领域并不存在。
我一直认为这意味着我想要的字段不在默认视图中,但即使我明确定义视图字段或更改查询,我仍然无法找到数据。我该怎么办?
以下是我所做的一些尝试,没有显示我正在寻找的字段。
方法1:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<ns0:Body>
<ns1:GetListItems>
<ns1:listName>{1A8A3DF2-E5D0-4DDE-B31A-CCC2FB7DA90F}</ns1:listName>
<viewFields>
<FieldRef Name="_ows_Title"/>
<FieldRef Name="_ows_Project_x0020_Description"/>
<FieldRef Name="_ows_Style_x0020_number_x0020_quantit"/>
<FieldRef Name="_ows_Requirement"/>
<FieldRef Name="_ows_First_x0020_order_x0020_entry_x0"/>
<FieldRef Name="_ows_MKT_x0020__x0025__x0020_Completi"/>
<FieldRef Name="_ows_MFG_x0020__x0025_Completion"/>
</viewFields>
<ns1:rowLimit>10</ns1:rowLimit>
</ns1:GetListItems>
</ns0:Body>
</SOAP-ENV:Envelope>
方法2:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<ns0:Body>
<ns1:GetListItems>
<ns1:listName>{1A8A3DF2-E5D0-4DDE-B31A-CCC2FB7DA90F}</ns1:listName>
<viewFields>
<FieldRef Name="Title"/>
<FieldRef Name="Project_x0020_Description"/>
<FieldRef Name="Style_x0020_number_x0020_quantit"/>
<FieldRef Name="Requirement"/>
<FieldRef Name="First_x0020_order_x0020_entry_x0"/>
<FieldRef Name="MKT_x0020__x0025__x0020_Completi"/>
<FieldRef Name="MFG_x0020__x0025_Completion"/>
</viewFields>
<ns1:rowLimit>10</ns1:rowLimit>
</ns1:GetListItems>
</ns0:Body>
</SOAP-ENV:Envelope>
方法3:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<ns0:Body>
<ns1:GetListItems>
<ns1:listName>{1A8A3DF2-E5D0-4DDE-B31A-CCC2FB7DA90F}</ns1:listName>
<Query>
<Where>
<Gt>
<FieldRef Name="ID"/>
<Value Type="Counter">0</Value>
</Gt>
</Where>
</Query>
<ns1:rowLimit>10</ns1:rowLimit>
</ns1:GetListItems>
</ns0:Body>
</SOAP-ENV:Envelope>
所有三种方法都会列出默认视图中的所有字段(忽略我的过滤器/查询),但正确地限制为10个结果。
答案 0 :(得分:0)
您的示例似乎缺少<{namespace}:viewFields>
架构定义的外部"http://schemas.microsoft.com/sharepoint/soap/"
节点。 (那或他们错过了参数主体中的内部<ViewFields>
节点。)
name
节点的FieldRef
属性应该是列的内部名称。
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<ns0:Body>
<ns1:GetListItems>
<ns1:listName>{1A8A3DF2-E5D0-4DDE-B31A-CCC2FB7DA90F}</ns1:listName>
<ns1:viewFields>
<ViewFields>
<FieldRef Name="Title"/>
<FieldRef Name="Project_x0020_Description"/>
<FieldRef Name="Style_x0020_number_x0020_quantit"/>
<FieldRef Name="Requirement"/>
<FieldRef Name="First_x0020_order_x0020_entry_x0"/>
<FieldRef Name="MKT_x0020__x0025__x0020_Completi"/>
<FieldRef Name="MFG_x0020__x0025_Completion"/>
</ViewFields>
</ns1:viewFields>
<ns1:rowLimit>10</ns1:rowLimit>
</ns1:GetListItems>
</ns0:Body>
</SOAP-ENV:Envelope>
请注意,即使您未在ViewFields
中指定,响应也会在结果中包含系统列(例如“标题”,“ID”和“已创建/已修改”)。