本文整理汇总了Python中sharepoint.xml.SP.viewName方法的典型用法代码示例。如果您正苦于以下问题:Python SP.viewName方法的具体用法?Python SP.viewName怎么用?Python SP.viewName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sharepoint.xml.SP
的用法示例。
在下文中一共展示了SP.viewName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_rows
# 需要导入模块: from sharepoint.xml import SP [as 别名]
# 或者: from sharepoint.xml.SP import viewName [as 别名]
def get_rows(self, folder='', view=''):
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))
# Uses parameters from https://msdn.microsoft.com/en-us/library/lists.lists.getlistitems(v=office.12).aspx
xml = SP.GetListItems(SP.listName(self.id),
SP.viewName(view),
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)