කියවපු විද්‍යුත් ලිපි එව්වෙ කවුද ??

මම කලින් ලිපියෙ සඳහන් කලානෙ කොහොමද එන ලිපියක් කියවන්නෙ කියල. කියෙව්වට මදිනෙ එව්වෙ කව්ද කියලත් හොයාගන්න ඔනෙ නෙ.

item.Recipients කිව්ව්ම කට්ටියගෙම නම් ටික හම්බ වෙනව. ප්‍රශ්නයක් නැහැ ඔයාට ඔනෙ එවපු කෙනාගෙ, යවපු කෙනාගෙ, කොපි වෙච්ච කට්ටියගෙ නම් ලැයිස්තුවනම් ඔනෙ. නිකම්ම ලූප් එකක් දාල ගන්න එකනෙ.

අවුල තියෙන්නෙ ඒ කට්ටියගෙ ලිපිනය xxx@xxx.xxx වගේ විදිහකට ගන්න ඔනෙ උනොත් පොඩි කචල් එකක් යනව (Recipient ගෙ Adress prperty එක එන්නෙ /O=TEST SYSTEMS INC./OU=EMPLOYEE/cn=Recipients/cn=GayanBalasooriya වගේ විදිහකට). ඉතින් ලිපිනය නිකම්ම ගන්න බැහැ. (පුලුවන් ක්‍රමයක් තියෙනවනම් මටත් කියන්න)
ඉතින් මේකත් විසඳගන්න ව්දිහක් හම්බ උන මෙන්න මේ ආකාරයට.

 foreach (Microsoft.Office.Interop.Outlook.Recipient rec in item.Recipients )
           {
                 string AddressOnSomethingAtSomethingFormat = this.GetSMTPAddress(rec.Address );
            }
මෙතඩ් එක එන්නෙ මෙන්න මේ විදිහට
public string GetSMTPAddress(String strAddress)
        {
            Microsoft.Office.Interop.Outlook.ContactItem contactItem = null;
            String strKey;
            String strRet;           

            contactItem = (Microsoft.Office.Interop.Outlook.ContactItem)app.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olContactItem);
            contactItem.Email1Address = strAddress;

            strKey = "_" + DateTime.Now.Ticks;
            contactItem.FullName = strKey;
            contactItem.Save();
            strRet = contactItem.Email1DisplayName.Replace("(", "").Replace(")", "").Replace(strKey, "").Trim (); 
            contactItem.Delete();
            contactItem = null;

            contactItem = (Microsoft.Office.Interop.Outlook.ContactItem)ns.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderDeletedItems).Items.Find("[Subject]=" + strKey);
            if (contactItem != null)
                contactItem.Delete();

            return strRet;

        }
මේකෙදි මොකද්ද වෙන්නෙ කියල ඔනේ කෙනෙකුට තේරෙයි පොඩ්ඩක් කෝඩ් එක කියෙව්ව නම්.
මම වැඩිය විස්තර කරන්නෙ නැත්තෙ මොකද; නැත්නම් කට්ටිය නිකම්ම කෝඩ් එක කොපි කරගෙන මුකුත් ඉගෙන ගන්නෙ නැති නිසා.
මොකක් හරි අවුලක්,කොස්සක්,තේරෙන්නෙ නැති තැනක් තියෙනවනම් අහන්න මම කොහොම හරි උත්තර දෙන්නම්.

0 ප්‍රතිචාර:

Post a Comment