You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Depending on the needs, you could also install the @microsoft/msgraph-sdk-javascript-beta side-by-side with the v1.0 one. Not covered in this walkthrough.
19
+
npm install @microsoft/msgraph-sdk-javascript --save ## Installing the Javascript service library should also install the core SDK and the types (based on the version of the service library).
// Allowing raw calls (using the .api() method instead of the full fluent API) is important for migration purposes and cases we don't know the resource beforehands (thinking Graph Explorer, mgt-get, etc.)
41
46
const meRaw =awaitgetMeRaw();
47
+
48
+
// Sending an email via the fluent API
42
49
awaitsendMail();
50
+
51
+
// Sending the email via the .api() method
43
52
awaitsendMailRaw();
44
53
54
+
// The types returned by the fluent API should be the same as the .api() area. It should also be the same (or at least very similar) as the current @microsoft/microsoft-graph-types to offer seamless migration.
45
55
asyncfunction getMe():Promise<User|undefined> {
46
56
returnawaitgraphClient.me.get();
47
57
}
48
58
49
-
asyncfunctiongetMe():Promise<User|undefined> {
59
+
asyncfunctiongetMeRaw():Promise<User|undefined> {
50
60
returnawaitgraphClient.api("/me").get();
51
61
}
52
62
53
63
asyncfunction sendMail():Promise<void> {
64
+
// Noting that we are using Interfaces and not Classes. There is an open discussion about this topic here https://github.com/microsoft/kiota/issues/1013
54
65
const message:Message= {
55
66
subject: "Hello Graph TypeScript SDK!",
56
67
body: {
@@ -96,6 +107,7 @@ async function sendMailRaw(): Promise<void> {
0 commit comments