Sharepoint Job ...正在访问和阅读列表 [英] Sharepoint Job... accessing and reading a list
本文介绍了Sharepoint Job ...正在访问和阅读列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试创建SharePoint作业以读取列表.....
我设法完成了工作,但是找不到在工作中访问列表的方法...
谁能帮我?
I am trying to create a SharePoint job to read a list.....
I managed to do the job but I can''t find a way to access the list within the job...
Can anyone help me? Thanks in advance!
推荐答案
SPWebApplication webApp = this.WebApplication;
SPSite site = this.WebApplication.Sites["SiteName"];
SPWeb web = site.OpenWeb("webUrl"); // or site.RootWeb;
SPList list = web.Lists["ListName"];
foreach (SPListItem item in list.Items)
{
// If you know what fields you want, you can try the below
object fieldValue = item["FieldName"];
// If you want to loop over all fields of an item
foreach (SPField field in item.Fields)
{
object fieldValue2 = item[field.Id];
// Do whatever you want with field values
}
}
这篇关于Sharepoint Job ...正在访问和阅读列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文