简体   繁体   English

如何在C#中使用sharepoint客户端模型获取所有内容类型组的列表

[英]how to get a list of all content type groups using sharepoint client model in c#

I am developing a windows application that will allow user with an interface to create custom content-types. 我正在开发Windows应用程序,该应用程序将允许用户使用界面来创建自定义内容类型。 Everything is done except I want a dropdown list that will show all available content-types, just like the Sharepoint has. 一切都完成了,只不过我想要一个下拉列表,它将显示所有可用的内容类型,就像Sharepoint一样。 在此处输入图片说明

What I've achieved so far is: 到目前为止,我已经实现了:

var contentTypes = context.Web.AvailableContentTypes.Where(q => q.Group == "List content type");

What exactly I want is a dropdown where all the content-type groups are listed just like the way the above image has. 我想要的是一个下拉列表,其中列出了所有内容类型组,就像上面的图像一样。

Please suggest a way to get this done. 请提出一种解决方案。 Thanks in advance! 提前致谢!

You can try something like this: 您可以尝试如下操作:

ClientContext ctx = new ClientContext("URL");

SP.Web web = ctx.Web;
ctx.Load(web, w => w.AvailableContentTypes);

var cts = ctx.Web.AvailableContentTypes;

ctx.ExecuteQuery();

var groups = cts.ToList().Select(ct => ct.Group).Distinct();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用c#获取Sharepoint List - How to get Sharepoint List using c# C#使用SharePoint客户端对象模型检查SharePoint列表权限 - C# Check SharePoint List permissions using SharePoint Client Object Model 在C#中以编程方式在Sharepoint中获取用户的所有组 - Get all groups of a User in Sharepoint programmatically in C# 如何使用C#以编程方式从SharePoint网站获取所有图片库的列表 - How to get list of all picture libraries from SharePoint site programatically using C# 如何使用 powershell/c# 列出 SharePoint 中的所有 2013 工作流 - How to list all 2013 workflows in SharePoint using powershell/c# 使用客户端对象模型在Sharepoint C#中创建ListItem - Create ListItem in Sharepoint C# Using Client-Object Model 如何使用c#在客户端获取建议的cardaction内容 - How to get suggested cardaction content on client using c# 如何在SharePoint 2010 C#中获取任务列表的相关内容的值? - How to get the value of related content of a task list in sharepoint 2010 C#? 将 Roslyn 用于 C#,如何获取组成返回类型的所有属性的列表? - Using Roslyn for C#, how do I get a list of all properties that compose a return type? SharePoint:如何按内容类型ID获取列表项? - SharePoint: How to get list items by Content type id?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM