通过客户端对象模型获取DefaultView
我想通过客户端对象模型加载Sharepoint 列表
的默认视图字段(我使用的是Silverlight)。以下是我发现的一些相关内容(在 msdn 上):
- 类
List
具有属性DefaultViewUrl
[类型为string
] - 类
List
具有方法GetView(Guid)< /代码>
- 类
List
具有属性Views
[类型为ViewCollection
] - 类
ViewCollection
具有方法GetById(Guid)
- 类
ViewCollection
具有方法GetByTitle(string)
- 类
View
具有属性DefaultView
[类型为bool
]
那是我能找到的一切。如您所见,没有直接获取 DefaultView 的方法(List
上缺少 DefaultViewId
属性或 GetByUrl(string)
方法>查看集合)。
在我看来,唯一的解决方案是迭代 List.Views
集合并检查每个 View
上的 DefaultView
属性。这有点……嗯,效率低下……
我错过了什么吗?有人看到一些直线孤立吗? 感谢您的想法。
I want to load fields of the default view for Sharepoint list
through client object model (I am using Silverlight). Here are some relevant things I've found (on msdn here):
- class
List
has propertyDefaultViewUrl
[of typestring
] - class
List
has methodGetView(Guid)
- class
List
has propertyViews
[of typeViewCollection
] - class
ViewCollection
has methodGetById(Guid)
- class
ViewCollection
has methodGetByTitle(string)
- class
View
has propertyDefaultView
[of typebool
]
That's everything I was able to find. As you can see there is no direct way of getting DefaultView (there is missing DefaultViewId
property on List
or GetByUrl(string)
method on ViewCollection
).
Seems to me as the only solution is to iterate through List.Views
collection and check DefaultView
property on each View
. Which is kind of...well, inefficient...
Did I miss something? Anyone see some straigh solition?
Thanks for ideas.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试使用 LINQ 语句进行 LoadQuery
例如:
此处的 MSDN SharePoint 2010 Silverlight COM 文章
http://msdn.microsoft.com/en-us/library/ee538971.aspx
Try LoadQuery using a LINQ statement
For Example:
MSDN SharePoint 2010 Silverlight COM article here
http://msdn.microsoft.com/en-us/library/ee538971.aspx
怎么样? SPList.DefaultView
? SPList DefaultView 成员是 SPView 对象(不是 bool)What about
SPList.DefaultView
? The SPList DefaultView member is an SPView object (not bool)