How do I update a sharepoint list using .net?

六月ゝ 毕业季﹏ 提交于 2019-12-13 00:28:17

问题


I have a SharePoint list already created. I would like to occassionally update that list using a .NET application. How would I do that?

EDIT: This has to run on remote machines.


回答1:


pgb's answer is correct. It's pretty simple, really. One caveat with this is that the code that uses the SharePoint object model must be running on the SharePoint server itself -- not a remote machine. If you're trying to interact with a SharePoint list remotely, you would probably want to use web services. SharePoint 2007 has decent coverage of list manipulation in its built-in web services, but if you want more specific functionality you can always roll your own.

A good starting point for the roll-your-own option is here: http://msdn.microsoft.com/en-us/library/ms464040.aspx

The SDK docs for the Lists web service can be found at http://msdn.microsoft.com/en-us/library/lists.aspx




回答2:


Assuming you have your siteId and webId you can do something like this:

using (SPSite site = new SPSite(siteId))
{
    SPWeb web = site.OpenWeb(webId);
    SPList list = web.Lists["ListName"];

    // Manipulate your SPList here
}



回答3:


Please, look this questions:

  • Update Sharepoint List Item
  • Create Sharepoint List which has gantt view - programmatically


来源:https://stackoverflow.com/questions/1711176/how-do-i-update-a-sharepoint-list-using-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!