Friday, July 8, 2011

Installing and configuring Google Web Toolkit and Eclipse.

Hi every one. In this post I’ll demonstrate the steps to install and configuring Eclipse and Google web toolkit. First of all what is GWT is? GWT or Google Web Toolkit is an open source development tool kit from Google. GWT is optimized for AJAX based complex applications. To work GWT you must know basics of Java and Web Development.

Mostly user IDE for GWT based applications is Eclipse but not necessarily you can use any IDE of your choice for Java (e.g. Net beans). 

GWT has many components not just SDK. It has plug in for Eclipse, GWT Designer lets you create user interfaces in minutes with tools for intelligent layout assist, drag-and-drop, and automatic code generation.

You will need the Java SDK version 1.5 or later. If necessary, download and install the Java SE Development Kit (JDK) for your platform. Mac users, see Apple's Java developer site to download and install the latest version of the Java Developer Kit available for Mac OS X.

Then download Eclipse. I used Eclipse 3.7 Indigo. You can download it from here.

 After Installing Eclipse got menu Help -> Install New Software and in Work with text box enter this Uri http://dl.google.com/eclipse/plugin/3.7

If you are using different version of Eclipse change the 3.7 with your version. Now click Add, and in pan below it will show two Options. "Plugin" and "SDK's" Select both options and click Finish. It will take a while to install these two items.

After Installing both plug in and SDK, Restart eclipse and go to menu File -> New -> Web Application Project. A Popup will appear. Name your package carefully as it should be unique and will later be used as identity on the App store. Don't forget to select "Use Google Web Toolkit" as show in image.

 

Ss-eclipse

 

for more help visit http://code.google.com/webtoolkit/.

 

I hope this will be helpful. Comments and suggestions are welcomed. 

Happy coding :)

 

Thursday, June 30, 2011

Sending Email Using Exchange Server 2010 EWS in Asp.Net / C#

Sending email using Exchange server EWS is breeze as compare to horrible syntaxed Web Dav ( sorry to WebDav Lovers :) ) . I worked with WebDav and many times banged my head against wall figuring out the actual issue in case of error.

EWS is web service based API of exchange server and provide very managed and readable code for sending email.

Let's start writing some code to work with ESW 2010.

First of all Add reference to Microsoft.Exchange.WebServices.dll and place Microsoft.Exchange.WebServices.xml file in your bin 

Next import following namespace.

 

using Microsoft.Exchange.WebServices;


 

public static void SendExchangeEmail(string to, string from, string subject, string body, string fileattach)

 

        ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010);

        service.Credentials = new NetworkCredential("ExchangeUser", "UserPassword");

        service.Url = new Uri("https://YourExchangeUrl/EWS/Exchange.asmx");

        EmailMessage newMsg = new EmailMessage(service);

        foreach (string s in to.Split(new char[] { ',' }))

        {

            newMsg.ToRecipients.Add(s.Trim());

        }

        newMsg.Body = body;

        newMsg.Subject = subject;

        newMsg.From = from;        

 

        if (!string.IsNullOrEmpty(fileattach))

        {

            newMsg.Attachments.AddFileAttachment(fileattach);

        }

 

        newMsg.SendAndSaveCopy();  OR ( depending upon your requirment)

        newMsg.Send();

}

 

Note: Use Send method just to send and use "SendAndSave" to save a copy in your sent items

Cheers :)