and got an exception “The email message cannot be sent .make sure the email has a valid recipient“.

The reason is the ClientContext, you are passing to the function. Make sure the sharepoint site with which you created the Client Context has the Mail Recipient listed in the All People Group. To check that,

Ever tried to set custom properties for the terms in your site navigation. Recently i tried the same but ended up searching for a while, after a lot of playing around , found a way to set custom properties. Following snippet will create a new term, set the target url , catalog target url and also set a custom shared property.

Ever tried to get tasks or emails from exchange using ews and faced this weird exception id is malformed. In my case, i had a http get to my ews method which accepted the id as a query string and id contains some special characters like +, / , = . and all the + characters were replaced by spaces during the http get call. a example id will look like this.

In simple terms, Interfaces provide code contracts which all classes that implement the interface have to follow.

Following is a simple example for a typescript interface and a class implementing the interface.

JavaScript

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

interfaceIAnimal

{

legs:number;

makeSound():string;

}

classDogimplementsIAnimal

{

legs:number;

makeSound()

{

return'Bow bow';

}

}

vardog=newDog();

dog.legs=4;

alert(dog.makeSound());

alert(dog.legs);

The above code sample creates an interface named IAnimal which has a property and a function which all animals have. The class Dog implements from this Interface and has to provide definition for the property and the function.

Classes and constructors are the bread and butter for any object oriented programming language. Following is the code sample on how to create classes and constructors in typescript. Class keyword is used to create a class.

JavaScript

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

classRectangle{

length:number;

breadth:number;

setLength(value:number)

{

this.length=value;

}

setBreadth(value:number)

{

this.breadth=value;

}

Area(){

returnthis.length*this.breadth;

}

}

varrect1=newRectangle();

rect1.setLength(10);

rect1.setBreadth(20);

alert(rect1.Area());

Following creates a new object of type Rectangle.

JavaScript

1

varrect1=newRectangle();

Typescript – Constructors

The above code can be also done using a constructor, following is how you would create a typescript constructor. the keyword to use here is constructor .