WebHosting

Showing posts with label Fetching All messages. Show all posts
Showing posts with label Fetching All messages. Show all posts

Monday, August 22, 2011

Fetching All Replies/Messages of a DISCUSSION List/TOPIC

string ite = string.Empty;
SPSite site = SPContext.Current.Site;
SPWeb web = site.OpenWeb();
SPList list = web.Lists["Emails"];
//Get the topic. (you can use other ways to get the topic)
SPFolder t = list.GetItemById(9).Folder;
SPQuery q = new SPQuery();
q.Folder = t;
SPListItemCollection res = list.GetItems(q);
foreach (SPListItem item1 in res)
{

object ss = item1["Body"];

object s1 = item1["EmailFrom"];
object s2 = item1["Modified"];


ite += " " + s1 + " " + ss + " " + s2.ToString() ;
for (int i = 0; i < item1.Attachments.Count; i++)
{
Response.Write("Attachment Url " + item1.Attachments.UrlPrefix + item1.Attachments + "
");
}



// Read body of attachment

Response.Write("Body: " + item1.Fields["Body"].GetFieldValueAsText(item1["Body"]) + "");
}
Response.Write(ite);

Featured Posts

How to Enable and Configure Remote Desktop (RDP) on Ubuntu 24.04.4 LTS

Remote Desktop Protocol (RDP) support in Ubuntu has become considerably easier with the GNOME Remote Desktop stack included in modern Ubuntu...