电子邮件通知中包含列表ID列的电子邮件主题
问题描述:
我需要使用c#从列表项值id中通知包含ID的电子邮件主题
闪电战
I need to notify in the email subject containing ID from the list item value id using c#
Blitz
答
Sree,
要从SP列表中获取商品的ID,请使用以下代码:
To get the ID of the item from SP list, here is the code:
using System;
using Microsoft.SharePoint;
namespace Test
{
class Program
{
static void Main(string[] args)
{
using (SPSite site = new SPSite("http://localhost"))
{
using (SPWeb web = site.OpenWeb())
{
SPList list = web.GetList("/lists/announcements");
SPListItemCollection items = list.Items;
for (int i = 0; i < items.Count; i++)
{
SPListItem item = items[i];
Console.WriteLine("Index = {0} ID = {1}", i, item.ID);
}
}
}
Console.ReadLine();
}
}
}