从XML文件填充任务列表 [英] Populate Task List from XML File
本文介绍了从XML文件填充任务列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从XML文件填充任务列表.我已经找到在线资源来填充正常列表,而不是任务列表.
I want to populate a task list from an XML file. I've found resources online to populate a normal list, but not a task list.
有人有什么建议吗?
推荐答案
SharePoint提供了REST API和CSOM方法来创建任务列表.
CSOM:
ClientContext clientContext = new ClientContext("https://gowtham.sharepoint.com/tutorials"); ListCreationInformation creationInfo = new ListCreationInformation(); creationInfo.Title = "New TASKList"; creationInfo.Description = "THis Task List created PRogrammatically"; creationInfo.TemplateType = (int)ListTemplateType.Tasks; web.Lists.Add(creationInfo); context.ExecuteQuery();
REST API:
url: http://site url/_api/web/lists method: POST body: { '__metadata': { 'type': 'SP.List' }, 'AllowContentTypes': true, 'BaseTemplate': 100, 'ContentTypesEnabled': true, 'Description': 'My list description', 'Title': 'Test' } Headers: Authorization: "Bearer " + accessToken X-RequestDigest: form digest value accept: "application/json;odata=verbose" content-type: "application/json;odata=verbose" content-length:length of post body
SPListTemplateType https://msdn.microsoft.com/zh-CN/library/microsoft.sharepoint.splisttemplatetype.aspx
我能否知道您的详细要求以及为什么要基于xml进行此操作?
最好的问候,
李
这篇关于从XML文件填充任务列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文