当前位置: 首页>>代码示例>>Python>>正文


Python SP.viewName方法代码示例

本文整理汇总了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)
开发者ID:m3nu,项目名称:python-sharepoint,代码行数:31,代码来源:__init__.py


注:本文中的sharepoint.xml.SP.viewName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。