moss discussion

static void Main(string[] args)
        {
            using (SPSite site = new SPSite("http://xy/"))
            {
                using (SPWeb web=site.OpenWeb())
                {
                    SPList lst = web.Lists["工作组讨论"];

                    foreach (SPListItem item in lst.Folders)
                    {
                        Console.WriteLine("************************************************");
                        Console.WriteLine("************************************************");
                        Console.WriteLine("主题为:" + item.Title.ToString());
                        foreach (SPListItem replay in lst.Items)
                        {
                            if (replay["ParentFolderId"].Equals(item.ID))
                            {
                                Console.WriteLine("----------------------------------------------------");
                                // Console.WriteLine(  item.DisplayName);
                                string str=replay.Fields["正文"].GetFieldValueAsText(replay["正文"]);
                                Console.WriteLine(str.Substring(0,str.IndexOf("发件人")).Trim());
                                Console.WriteLine("----------------------------------------------------");
                            }                         
                        }                     
                    }   
                }
            }
            Console.ReadLine();
        }

你可能感兴趣的:(SSI)