About Me

My photo
a Dynamic and Energetic guy.....

Wednesday, November 26, 2008

Deploy .Cab Solution Webpart into sharepoint

(1) Open the command prompt
(2) Change the path to C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\bin
(3) run the stsadm command to deploy the cab file
stsadm -o addwppack -globalinstall -force -filename C:\SearchWebPart_CSharp.cab

(4) Go to sharepoint site's webpart gallery
(5) Go --> New and populate the webpart
(6) Add the webpart into your page :)

Monday, November 24, 2008

Sending an Email Using .NET

private void sendingEmail(string pstrSendingEmails)
{
try
{
System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();
System.Net.NetworkCredential cred = new System.Net.NetworkCredential("irononechanaka@gmail.com", "password1");

string strEmails = "sahanganepola@yahoo.com";
mail.To.Add(strEmails);

mail.Subject = "Email from workflow ";
mail.From = new System.Net.Mail.MailAddress(strEmails);
mail.IsBodyHtml = true;
mail.Body = "hi dear friend";

System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("smtp.gmail.com");
smtp.UseDefaultCredentials = false;
smtp.EnableSsl = true;
smtp.Credentials = cred;
smtp.Port = 587;
smtp.Send(mail);
}
catch (Exception ex)
{

}
}

My Masters