c# - Accessing Outlook ost file -


i have seen difference between pst , ost files , working on accessing outlook pst file through following code given below. there way use same code accessing ost file? can refer me this?

private datatable getinboxitems() {     datatable inboxtable;     //try     //{     filter = "[receivedtime] >= '" + dtpstartdate.value.tostring("dd/mm/yyyy 12:00 am")   + "' , [receivedtime] <= '" + dtpenddate.value.tostring("dd/mm/yyyy  11:59 pm") + "'";     outlook.application outlookapp = getapplicationobject();     outlook.folder root = outlookapp.session.defaultstore.getrootfolder()  outlook.folder;     enumeratefolders(root);     //string filter = "[receivedtime] > '" + dtpstartdate.value.tostring("dd/mm/yyyy")  + "'";      //inbox     outlook.mapifolder inboxfolder =  outlookapp.session.getdefaultfolder(outlook.oldefaultfolders.olfolderinbox);     inboxtable = createtable();     int count = 0;       if (inboxfolder.items.count > 0)     {          var restricteditems = inboxfolder.items.restrict(filter);         restricteditems.sort("[receivedtime]", true); //descending         //foreach (var item in inboxfolder.items)         foreach (var item in restricteditems)         {             var mail = item outlook.mailitem;             if (mail != null)             {                 //try                 //{                 datarow row = inboxtable.newrow();                 //row["sn"] = (++count).tostring();                 row["sn"] = mail.entryid + " " + mail.receivedbyentryid;                 row["mailtype"] = "inbox";                 row["sendername"] = mail.sendername;                 row["senderemail"] = mail.senderemailaddress;                 row["receiveddate"] = mail.receivedtime;                 row["subject"] = mail.subject;                 row["body"] = mail.body != null ? (mail.body.length > 25 ?  mail.body.substring(0, 25) : mail.body) : null;                 //row["body"] = mail.body != null ? mail.body : "";                 row["mailsize"] = mail.size.tostring();                 string attachments = null;                 if (mail.attachments.count > 0)                 {                     foreach (var attachment in mail.attachments)                     {                         if (((outlook.attachment)attachment) != null)                             //attachments = ((outlook.attachment)attachment).filename +  " " + ((outlook.attachment)attachment).size.tostring() + ", ";                             attachments += (((outlook.attachment)attachment).size / 1024).tostring() + " kb, ";                     }                 }                   row["attachmentcount"] = mail.attachments.count;                 if (attachments != null)                     row["attachmentsize"] = attachments.substring(0, attachments.length - 2);                  inboxtable.rows.add(row);             }             //catch (exception ex)             //{              //    return null;             //}          }     }      return inboxtable; } 

you need educate on ost/pst access them not different, both store objects have same interface.

try sources start , experiment it's best way understand how stuff works.

http://en.wikipedia.org/wiki/personal_storage_table

http://msdn.microsoft.com/en-us/library/bb609139(v=office.14).aspx

http://msdn.microsoft.com/en-us/library/ff184648(v=office.14).aspx

http://msdn.microsoft.com/en-us/library/bb208208(v=office.12).aspx

http://www.c-sharpcorner.com/uploadfile/rambab/outlookintegration10282006032802am/outlookintegration.aspx


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -