Python SOAP到MS WebService(SharePoint)(GetListItems)
我试图从sharepoint服务器(通过python/suds)中提取列表项,但在查询GetListItems时遇到了一些困难。如果我没有为GetListItems提供列表名以外的其他参数,它将返回该列表默认视图中的所有项目。我想查询要返回的一组特定项目(ID=15)以及要为这些项目返回的一组特定字段(日期和说明)。这是我的SOAP包:Python SOAP到MS WebService(SharePoint)(GetListItems),python,soap,Python,Soap,我试图从sharepoint服务器(通过python/suds)中提取列表项,但在查询GetListItems时遇到了一些困难。如果我没有为GetListItems提供列表名以外的其他参数,它将返回该列表默认视图中的所有项目。我想查询要返回的一组特定项目(ID=15)以及要为这些项目返回的一组特定字段(日期和说明)。这是我的SOAP包: <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:ns0="ht
<?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>MyCalendar</ns1:listName>
<query>
<Where>
<Eq>
<FieldRef Name="_ows_ID">15</FieldRef>
</Eq>
</Where>
</query>
<viewFields>
<FieldRef Name="Description"/>
<FieldRef Name="EventDate"/>
</viewFields>
</ns1:GetListItems>
</ns0:Body>
</SOAP-ENV:Envelope>
任何帮助都将不胜感激 我想出来了。问题是CAML查询 1。您需要将CAML“Query”包装在“Query”元素中 2。您需要设置正确的“值类型”元素和属性 有关更多信息和代码,请参阅其他标题为“Sharepoint列表项过滤器(GetListItems)”的帖子 谢谢!
尼克这是另一篇带有代码的帖子的链接。
query = Element('query')
where = Element('Where')
eq = Element('Eq')
eq.append(Element('FieldRef').append(Attribute('Name', '_ows_ID')).setText('15'))
where.append(eq)
query.append(where)
viewFields = Element('viewFields')
viewFields.append(Element('FieldRef').append(Attribute('Name','Description')))
viewFields.append(Element('FieldRef').append(Attribute('Name','EventDate')))
results = c_lists.service.GetListItems('MyCalendar', None, query, viewFields, None, None)