电子邮件通知中包含列表ID列的电子邮件主题 [英] email subject containing list ID column in the email notification

查看:260
本文介绍了电子邮件通知中包含列表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();
        }
    }
}

参考: https://msdn.microsoft.com/zh-CN/library/microsoft.sharepoint.splistitem.id.aspx?f=255&MSPPError=-2147217396


这篇关于电子邮件通知中包含列表ID列的电子邮件主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆