本文整理汇总了Python中sharepoint.xml.SP.viewFields方法的典型用法代码示例。如果您正苦于以下问题:Python SP.viewFields方法的具体用法?Python SP.viewFields怎么用?Python SP.viewFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sharepoint.xml.SP
的用法示例。
在下文中一共展示了SP.viewFields方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_rows
# 需要导入模块: from sharepoint.xml import SP [as 别名]
# 或者: from sharepoint.xml.SP import viewFields [as 别名]
def get_rows(self, folder=''):
rows = []
attribs = collections.defaultdict(dict)
field_groups, lookup_count = [[]], 0
for field in self.fields.values():
if isinstance(field, (UserField, LookupField)):
lookup_count += 1
if lookup_count >= 8:
lookup_count = 0
field_groups.append([])
field_groups[-1].append(field)
for field_group in field_groups:
# Request all fields, not just the ones in the default view
view_fields = E.ViewFields(*(E.FieldRef(Name=field.name) for field in field_group))
#query_options = E.QueryOptions(E.ViewAttributes(Scope="Recursive"))
query_options = E.QueryOptions(E.Folder(folder))
xml = SP.GetListItems(SP.listName(self.id),
SP.rowLimit("100000"),
SP.viewFields(view_fields),
SP.queryOptions(query_options))
response = self.opener.post_soap(LIST_WEBSERVICE, xml)
for row in list(response[0][0][0]):
attrib = attribs[row.attrib['ows_ID']]
attrib.update(row.attrib)
for attrib in attribs.values():
rows.append(self.Row(attrib=attrib))
return list(rows)
示例2: rows
# 需要导入模块: from sharepoint.xml import SP [as 别名]
# 或者: from sharepoint.xml.SP import viewFields [as 别名]
def rows(self):
if not hasattr(self, "_rows"):
attribs = collections.defaultdict(dict)
field_groups, lookup_count = [[]], 0
for field in self.fields.values():
if isinstance(field, (UserField, LookupField)):
lookup_count += 1
if lookup_count >= 8:
lookup_count = 0
field_groups.append([])
field_groups[-1].append(field)
for field_group in field_groups:
# Request all fields, not just the ones in the default view
view_fields = E.ViewFields(*(E.FieldRef(Name=field.name) for field in field_group))
xml = SP.GetListItems(SP.listName(self.id), SP.rowLimit("100000"), SP.viewFields(view_fields))
response = self.opener.post_soap(LIST_WEBSERVICE, xml)
for row in list(response[0][0][0]):
attrib = attribs[row.attrib["ows_ID"]]
attrib.update(row.attrib)
self._rows = []
for attrib in attribs.values():
self._rows.append(self.Row(attrib=attrib))
return list(self._rows)