ms-graph-types 2.43.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,152 @@
1
+ [![npm バージョン バッジ](https://img.shields.io/npm/v/@microsoft/microsoft-graph-types.svg)](https://www.npmjs.com/package/@microsoft/microsoft-graph-types)
2
+
3
+ # Microsoft Graph TypeScript 型
4
+ Microsoft Graph TypeScript 定義により、編集者は、ユーザー、メッセージ、グループを含む Microsoft Graph オブジェクトに Intellisense を提供できます。
5
+
6
+ ## インストール
7
+
8
+ このパッケージを [npm](https://www.npmjs.com/)からダウンロードして、.d.ts ファイルを含めることをお勧めします。
9
+
10
+ ```bash
11
+
12
+ # Install types and save in package.json as a development dependency
13
+ npm install @microsoft/microsoft-graph-types --save-dev
14
+
15
+ ```
16
+
17
+
18
+ ![Visual Studio Code の Intellisense を表示する GIF と Microsoft Graph エンティティのオートコンプリーション](https://github.com/microsoftgraph/msgraph-typescript-typings/raw/master/typings-demo.gif)
19
+ ## 例
20
+ 次の例では、有効なアクセス トークンがあることを前提としています。要求を実行するために [isomorphic-fetch](https://www.npmjs.com/package/isomorphic-fetch) を使用していましたが、[当社の JavaScript クライアント ライブラリ](https://github.com/microsoftgraph/msgraph-sdk-javascript)または他のライブラリを使用することもできます。
21
+ ```typescript
22
+ import * as MicrosoftGraph from "@microsoft/microsoft-graph-types"
23
+
24
+ import * from 'isomorphic-fetch';
25
+ const accessToken:string = "";
26
+ ```
27
+ ### 最近使用したメッセージを一覧表示する
28
+ ```typescript
29
+ let url = "https://graph.microsoft.com/v1.0/me/messages";
30
+ let request = new Request(url, {
31
+ method: "GET",
32
+ headers: new Headers({
33
+ "Authorization": "Bearer " + accessToken
34
+ })
35
+ });
36
+
37
+ fetch(request)
38
+ .then((response) => {
39
+ response.json().then((res) => {
40
+ let messages:[MicrosoftGraph.Message] = res.value;
41
+ for (let msg of messages) { //iterate through the recent messages
42
+ console.log(msg.subject);
43
+ console.log(msg.toRecipients[0].emailAddress.address);
44
+ }
45
+ });
46
+
47
+ })
48
+ .catch((error) => {
49
+ console.error(error);
50
+ });
51
+ ```
52
+ ### ログインしているユーザーとしてメールを送信する
53
+ ```typescript
54
+ // Create the message object
55
+
56
+ // Note that all the properties must follow the interface definitions.
57
+ // For example, this will not compile if you try to type "xml" instead of "html" for contentType.
58
+
59
+ let mail:MicrosoftGraph.Message = {
60
+ subject: "Microsoft Graph TypeScript Sample",
61
+ toRecipients: [{
62
+ emailAddress: {
63
+ address: "microsoftgraph@example.com"
64
+ }
65
+ }],
66
+ body: {
67
+ content: "<h1>Microsoft Graph TypeScript Sample</h1>Try modifying the sample",
68
+ contentType: "html"
69
+ }
70
+ }
71
+ // send the email by sending a POST request to the Microsoft Graph
72
+ let url = "https://graph.microsoft.com/v1.0/users/me/sendMail";
73
+ let request = new Request(
74
+ url, {
75
+ method: "POST",
76
+ body: JSON.stringify({
77
+ message: mail
78
+ }),
79
+ headers: new Headers({
80
+ "Authorization": "Bearer " + accessToken,
81
+ 'Content-Type': 'application/json'
82
+ })
83
+ }
84
+ );
85
+
86
+ fetch(request)
87
+ .then((response) => {
88
+ if(response.ok === true) {
89
+ console.log("Mail sent successfully..!!");
90
+ }
91
+ })
92
+ .catch((err) => {
93
+ console.error(err);
94
+ });
95
+
96
+ ```
97
+ ## Microsoft Graph ベータ版をサポート
98
+ Microsoft Graph ベータ版のエンドポイントをテストする場合は、これらの型を v1.0 の型と同時に使用できます。
99
+
100
+ package.json ファイルを次のように更新します。
101
+
102
+ ```javascript
103
+ "devDependencies": {
104
+ // import published v1.0 types with a version from NPM
105
+ "@microsoft/microsoft-graph-types": "^0.4.0",
106
+
107
+ // import beta types from the beta branch on the GitHub repo
108
+ "@microsoft/microsoft-graph-types-beta": "microsoftgraph/msgraph-typescript-typings#beta"
109
+ }
110
+ }
111
+ ```
112
+
113
+ `@microsoft/microsoft-graph-types-beta` からベータ タイプをインポートする
114
+ ```typescript
115
+ // import individual entities
116
+ import {User as BetaUser} from "@microsoft/microsoft-graph-types-beta"
117
+
118
+ // or import everything under MicrosoftGraphBeta
119
+ import * as MicrosoftGraphBeta from "@microsoft/microsoft-graph-types-beta"
120
+ ```
121
+
122
+ ## サポートされるエディター
123
+ 少なくとも TypeScript 2.0 を使用している場合、TypeScript プロジェクトはこれらの型を使用できます。次のエディターで依存関係として型を含めることをテストしました。
124
+ * Visual Studio Code
125
+ * WebStorm
126
+ * [atom-typescript](https://atom.io/packages/atom-typescript) プラグインを使用する Atom
127
+
128
+ ## 質問とコメント
129
+
130
+ TypeScript 定義プロジェクトに関するフィードバックをお寄せください。質問や提案につきましては、このリポジトリの「[問題](https://github.com/microsoftgraph/msgraph-typescript-typings/issues)」セクションで送信できます。
131
+
132
+
133
+ ## 投稿
134
+ [投稿ガイドライン](CONTRIBUTING.md)を参照してください。
135
+
136
+ ## その他のリソース
137
+
138
+ * [Microsoft Graph](https://graph.microsoft.io)
139
+ * [Office デベロッパー センター](http://dev.office.com/)
140
+ * [Microsoft Graph JavaScript クライアント ライブラリ](https://github.com/microsoftgraph/msgraph-sdk-javascript)
141
+
142
+ ## セキュリティ レポート
143
+
144
+ ライブラリまたはサービスでセキュリティに関する問題を発見した場合は、できるだけ詳細に [secure@microsoft.com](mailto:secure@microsoft.com) に報告してください。提出物は、[Microsoft Bounty](http://aka.ms/bugbounty) プログラムを通じて報酬を受ける対象となる場合があります。セキュリティの問題を GitHub の問題や他のパブリック サイトに投稿しないでください。情報を受け取り次第、ご連絡させていただきます。セキュリティの問題が発生したときに通知を受け取ることをお勧めします。そのためには、[このページ](https://technet.microsoft.com/en-us/security/dd252948)にアクセスし、セキュリティ アドバイザリ通知を受信登録してください。
145
+
146
+ ## ライセンス
147
+
148
+ Copyright (c) Microsoft Corporation。All rights reserved.MIT ライセンス ("ライセンス") に基づいてライセンスされています。
149
+
150
+ ## Microsoft Open Source Code of Conduct (Microsoft オープン ソース倫理規定) を尊重し、遵守します
151
+
152
+ このプロジェクトでは、[Microsoft Open Source Code of Conduct (Microsoft オープン ソース倫理規定)](https://opensource.microsoft.com/codeofconduct/) が採用されています。詳細については、「[Code of Conduct の FAQ (倫理規定の FAQ)](https://opensource.microsoft.com/codeofconduct/faq/)」を参照してください。また、その他の質問やコメントがあれば、[opencode@microsoft.com](mailto:opencode@microsoft.com) までお問い合わせください。
@@ -0,0 +1,152 @@
1
+ [![selo de versão do npm](https://img.shields.io/npm/v/@microsoft/microsoft-graph-types.svg)](https://www.npmjs.com/package/@microsoft/microsoft-graph-types)
2
+
3
+ # Tipos de TypeScript do Microsoft Graph
4
+ As definições de TypeScript do Microsoft Graph permitem que os editores forneçam o IntelliSense em objetos do Microsoft Graph, incluindo usuários, mensagens e grupos.
5
+
6
+ ## Instalação
7
+
8
+ Recomendamos incluir o arquivo .d.ts baixando esse pacote pelo [npm](https://www.npmjs.com/).
9
+
10
+ ```bash
11
+
12
+ # Install types and save in package.json as a development dependency
13
+ npm install @microsoft/microsoft-graph-types --save-dev
14
+
15
+ ```
16
+
17
+
18
+ ![GIF que mostra o IntelliSense e o preenchimento automático para entidades do Microsoft Graph no Visual Studio Code](https://github.com/microsoftgraph/msgraph-typescript-typings/raw/master/typings-demo.gif)
19
+ ## Exemplos
20
+ Os exemplos a seguir supõem que você tenha um token de acesso válido. Usamos [isomorphic-fetch](https://www.npmjs.com/package/isomorphic-fetch) para executar solicitações, mas você também pode usar [nossa biblioteca de cliente de JavaScript](https://github.com/microsoftgraph/msgraph-sdk-javascript) ou outras bibliotecas.
21
+ ```typescript
22
+ import * as MicrosoftGraph from "@microsoft/microsoft-graph-types"
23
+
24
+ import * from 'isomorphic-fetch';
25
+ const accessToken:string = "";
26
+ ```
27
+ ### Lista minhas mensagens recentes
28
+ ```typescript
29
+ let url = "https://graph.microsoft.com/v1.0/me/messages";
30
+ let request = new Request(url, {
31
+ method: "GET",
32
+ headers: new Headers({
33
+ "Authorization": "Bearer " + accessToken
34
+ })
35
+ });
36
+
37
+ fetch(request)
38
+ .then((response) => {
39
+ response.json().then((res) => {
40
+ let messages:[MicrosoftGraph.Message] = res.value;
41
+ for (let msg of messages) { //iterate through the recent messages
42
+ console.log(msg.subject);
43
+ console.log(msg.toRecipients[0].emailAddress.address);
44
+ }
45
+ });
46
+
47
+ })
48
+ .catch((error) => {
49
+ console.error(error);
50
+ });
51
+ ```
52
+ ### Envia um email como o usuário conectado
53
+ ```typescript
54
+ // Create the message object
55
+
56
+ // Note that all the properties must follow the interface definitions.
57
+ // For example, this will not compile if you try to type "xml" instead of "html" for contentType.
58
+
59
+ let mail:MicrosoftGraph.Message = {
60
+ subject: "Microsoft Graph TypeScript Sample",
61
+ toRecipients: [{
62
+ emailAddress: {
63
+ address: "microsoftgraph@example.com"
64
+ }
65
+ }],
66
+ body: {
67
+ content: "<h1>Microsoft Graph TypeScript Sample</h1>Try modifying the sample",
68
+ contentType: "html"
69
+ }
70
+ }
71
+ // send the email by sending a POST request to the Microsoft Graph
72
+ let url = "https://graph.microsoft.com/v1.0/users/me/sendMail";
73
+ let request = new Request(
74
+ url, {
75
+ method: "POST",
76
+ body: JSON.stringify({
77
+ message: mail
78
+ }),
79
+ headers: new Headers({
80
+ "Authorization": "Bearer " + accessToken,
81
+ 'Content-Type': 'application/json'
82
+ })
83
+ }
84
+ );
85
+
86
+ fetch(request)
87
+ .then((response) => {
88
+ if(response.ok === true) {
89
+ console.log("Mail sent successfully..!!");
90
+ }
91
+ })
92
+ .catch((err) => {
93
+ console.error(err);
94
+ });
95
+
96
+ ```
97
+ ## Suporte ao Microsoft Graph beta
98
+ Se você quer testar os pontos de extremidade do Microsoft Graph beta, é possível usá-los simultaneamente com os tipos v 1.0.
99
+
100
+ Atualize o arquivo package.json com o seguinte:
101
+
102
+ ```javascript
103
+ "devDependencies": {
104
+ // import published v1.0 types with a version from NPM
105
+ "@microsoft/microsoft-graph-types": "^0.4.0",
106
+
107
+ // import beta types from the beta branch on the GitHub repo
108
+ "@microsoft/microsoft-graph-types-beta": "microsoftgraph/msgraph-typescript-typings#beta"
109
+ }
110
+ }
111
+ ```
112
+
113
+ Importe os tipos beta de `@microsoft/microsoft-graph-types-beta`
114
+ ```typescript
115
+ // import individual entities
116
+ import {User as BetaUser} from "@microsoft/microsoft-graph-types-beta"
117
+
118
+ // or import everything under MicrosoftGraphBeta
119
+ import * as MicrosoftGraphBeta from "@microsoft/microsoft-graph-types-beta"
120
+ ```
121
+
122
+ ## Editores compatíveis
123
+ Todos os projetos TypeScript podem consumir esses tipos ao usar pelo menos o TypeScript 2.0. Testamos e incluímos os tipos como uma dependência nos editores a seguir.
124
+ * Visual Studio Code
125
+ * WebStorm
126
+ * Atom with the [atom-typescript](https://atom.io/packages/atom-typescript) plugin
127
+
128
+ ## Perguntas e comentários
129
+
130
+ Gostaríamos de saber sua opinião sobre o projeto de definições de TypeScript. Você pode enviar perguntas e sugestões na seção [Problemas](https://github.com/microsoftgraph/msgraph-typescript-typings/issues) deste repositório.
131
+
132
+
133
+ ## Colaboração
134
+ Confira as [diretrizes de colaboração](CONTRIBUTING.md).
135
+
136
+ ## Recursos adicionais
137
+
138
+ * [Microsoft Graph](https://graph.microsoft.io)
139
+ * [Centro de Desenvolvimento do Office](http://dev.office.com/)
140
+ * [Biblioteca de cliente de JavaScript do Microsoft Graph](https://github.com/microsoftgraph/msgraph-sdk-javascript)
141
+
142
+ ## Relatórios de segurança
143
+
144
+ Se você encontrar um problema de segurança com nossas bibliotecas ou serviços, informe-o em [secure@microsoft.com](mailto:secure@microsoft.com) com o máximo de detalhes possível. O seu envio pode estar qualificado para uma recompensa por meio do programa [Microsoft Bounty](http://aka.ms/bugbounty). Não poste problemas de segurança nos Problemas do GitHub ou qualquer outro site público. Entraremos em contato com você em breve após receber as informações. Recomendamos que você obtenha notificações sobre a ocorrência de incidentes de segurança visitando [esta página](https://technet.microsoft.com/en-us/security/dd252948) e assinando os alertas do Security Advisory.
145
+
146
+ ## Licença
147
+
148
+ Copyright (c) Microsoft Corporation. Todos os direitos reservados. Licenciada sob a Licença do MIT (a "Licença");
149
+
150
+ ## Valorizamos e cumprimos o Código de Conduta de Código Aberto da Microsoft
151
+
152
+ Este projeto adotou o [Código de Conduta de Código Aberto da Microsoft](https://opensource.microsoft.com/codeofconduct/). Para saber mais, confira as [Perguntas frequentes sobre o Código de Conduta](https://opensource.microsoft.com/codeofconduct/faq/) ou entre em contato pelo [opencode@microsoft.com](mailto:opencode@microsoft.com) se tiver outras dúvidas ou comentários.
@@ -0,0 +1,152 @@
1
+ [![эмблема версии npm](https://img.shields.io/npm/v/@microsoft/microsoft-graph-types.svg)](https://www.npmjs.com/package/@microsoft/microsoft-graph-types)
2
+
3
+ # Типы TypeScript для Microsoft Graph
4
+ С помощью определений TypeScript для Microsoft Graph, редакторы могут использовать функции intellisense для объектов Microsoft Graph, включая пользователей, сообщения и группы.
5
+
6
+ ## Установка
7
+
8
+ Рекомендуем включить файл .d.ts, загрузив его в [npm](https://www.npmjs.com/).
9
+
10
+ ```bash
11
+
12
+ # Install types and save in package.json as a development dependency
13
+ npm install @microsoft/microsoft-graph-types --save-dev
14
+
15
+ ```
16
+
17
+
18
+ ![GIF функции intellisense и автоматическое заполнение сущностей Microsoft Graph в Visual Studio Code ](https://github.com/microsoftgraph/msgraph-typescript-typings/raw/master/typings-demo.gif)
19
+ ## Примеры
20
+ В следующих примерах предполагается, что у вас есть действительный маркер доступа. Для выполнения запросов мы использовали [isomorphic-fetch](https://www.npmjs.com/package/isomorphic-fetch), но вы можете использоватькак нашу [клиентскую библиотеку JavaScript](https://github.com/microsoftgraph/msgraph-sdk-javascript), так и другую.
21
+ ```typescript
22
+ import * as MicrosoftGraph from "@microsoft/microsoft-graph-types"
23
+
24
+ import * from 'isomorphic-fetch';
25
+ const accessToken:string = "";
26
+ ```
27
+ ### Список недавних сообщений
28
+ ```typescript
29
+ let url = "https://graph.microsoft.com/v1.0/me/messages";
30
+ let request = new Request(url, {
31
+ method: "GET",
32
+ headers: new Headers({
33
+ "Authorization": "Bearer " + accessToken
34
+ })
35
+ });
36
+
37
+ fetch(request)
38
+ .then((response) => {
39
+ response.json().then((res) => {
40
+ let messages:[MicrosoftGraph.Message] = res.value;
41
+ for (let msg of messages) { //iterate through the recent messages
42
+ console.log(msg.subject);
43
+ console.log(msg.toRecipients[0].emailAddress.address);
44
+ }
45
+ });
46
+
47
+ })
48
+ .catch((error) => {
49
+ console.error(error);
50
+ });
51
+ ```
52
+ ### Отправка сообщения пользователя, выполнившего вход
53
+ ```typescript
54
+ // Create the message object
55
+
56
+ // Note that all the properties must follow the interface definitions.
57
+ // For example, this will not compile if you try to type "xml" instead of "html" for contentType.
58
+
59
+ let mail:MicrosoftGraph.Message = {
60
+ subject: "Microsoft Graph TypeScript Sample",
61
+ toRecipients: [{
62
+ emailAddress: {
63
+ address: "microsoftgraph@example.com"
64
+ }
65
+ }],
66
+ body: {
67
+ content: "<h1>Microsoft Graph TypeScript Sample</h1>Try modifying the sample",
68
+ contentType: "html"
69
+ }
70
+ }
71
+ // send the email by sending a POST request to the Microsoft Graph
72
+ let url = "https://graph.microsoft.com/v1.0/users/me/sendMail";
73
+ let request = new Request(
74
+ url, {
75
+ method: "POST",
76
+ body: JSON.stringify({
77
+ message: mail
78
+ }),
79
+ headers: new Headers({
80
+ "Authorization": "Bearer " + accessToken,
81
+ 'Content-Type': 'application/json'
82
+ })
83
+ }
84
+ );
85
+
86
+ fetch(request)
87
+ .then((response) => {
88
+ if(response.ok === true) {
89
+ console.log("Mail sent successfully..!!");
90
+ }
91
+ })
92
+ .catch((err) => {
93
+ console.error(err);
94
+ });
95
+
96
+ ```
97
+ ## Поддержка бета-версии Microsoft Graph
98
+ Если вы хотите протестировать конечные точки бета-версии Microsoft Graph, используйте эти типы одновременно с типами версии 1.0.
99
+
100
+ Обновите файл package.json, выполнив следующее:
101
+
102
+ ```javascript
103
+ "devDependencies": {
104
+ // import published v1.0 types with a version from NPM
105
+ "@microsoft/microsoft-graph-types": "^0.4.0",
106
+
107
+ // import beta types from the beta branch on the GitHub repo
108
+ "@microsoft/microsoft-graph-types-beta": "microsoftgraph/msgraph-typescript-typings#beta"
109
+ }
110
+ }
111
+ ```
112
+
113
+ Импортируйте бета типы из `@microsoft/microsoft-graph-types-beta`
114
+ ```typescript
115
+ // import individual entities
116
+ import {User as BetaUser} from "@microsoft/microsoft-graph-types-beta"
117
+
118
+ // or import everything under MicrosoftGraphBeta
119
+ import * as MicrosoftGraphBeta from "@microsoft/microsoft-graph-types-beta"
120
+ ```
121
+
122
+ ## Поддерживаемые редакторы
123
+ Любой проект TypeScript может использовать эти типы с помощью TypeScript 2.0 или более поздней версии. Мы протестированы типы как зависимость в следующих редакторах.
124
+ * Visual Studio Code
125
+ * WebStorm
126
+ * Atom с плагином [atom-typescript](https://atom.io/packages/atom-typescript)
127
+
128
+ ## Вопросы и комментарии
129
+
130
+ Мы будем рады получить от вас отзывы о проекте "Определения TypeScript". Вы можете отправлять нам вопросы и предложения в разделе [Проблемы](https://github.com/microsoftgraph/msgraph-typescript-typings/issues) этого репозитория.
131
+
132
+
133
+ ## Помощь
134
+ См. [добавление рекомендаций](CONTRIBUTING.md).
135
+
136
+ ## Дополнительные ресурсы
137
+
138
+ * [Microsoft Graph](https://graph.microsoft.io)
139
+ * [Центр разработчиков Office](http://dev.office.com/)
140
+ * [Клиентская библиотека JavaScript для Microsoft Graph](https://github.com/microsoftgraph/msgraph-sdk-javascript)
141
+
142
+ ## Отчеты о безопасности
143
+
144
+ Если вы столкнулись с проблемами безопасности наших библиотек или служб, сообщите о проблеме по адресу [secure@microsoft.com](mailto:secure@microsoft.com), добавив как можно больше деталей. Возможно, вы получите вознаграждение, в рамках программы [Microsoft Bounty](http://aka.ms/bugbounty). Не публикуйте ошибки безопасности в ошибках GitHub или на любом общедоступном сайте. Вскоре после получения информации, мы свяжемся с вами. Рекомендуем вам настроить уведомления о нарушениях безопасности. Это можно сделать, подписавшись на уведомления безопасности консультационных служб на [этой странице](https://technet.microsoft.com/en-us/security/dd252948).
145
+
146
+ ## Лицензия
147
+
148
+ © Корпорация Майкрософт. Все права защищены. Предоставляется по лицензии MIT ("Лицензия");
149
+
150
+ ## В соответствии с "Правилами поведения разработчиков открытого кода Майкрософт".
151
+
152
+ Этот проект соответствует [Правилам поведения разработчиков открытого кода Майкрософт](https://opensource.microsoft.com/codeofconduct/). Дополнительные сведения см. в разделе [часто задаваемых вопросов о правилах поведения](https://opensource.microsoft.com/codeofconduct/faq/). Если у вас возникли вопросы или замечания, напишите нам по адресу [opencode@microsoft.com](mailto:opencode@microsoft.com).
@@ -0,0 +1,152 @@
1
+ [![npm 版本徽章](https://img.shields.io/npm/v/@microsoft/microsoft-graph-types.svg)](https://www.npmjs.com/package/@microsoft/microsoft-graph-types)
2
+
3
+ # Microsoft Graph TypeScript 类型
4
+ Microsoft Graph TypeScript 定义使编辑器可以提供有关 Microsoft Graph 对象(包括用户、邮件和组)的智能感知。
5
+
6
+ ## 安装
7
+
8
+ 建议通过 [npm](https://www.npmjs.com/) 下载此包以便包含 .d.ts 文件。
9
+
10
+ ```bash
11
+
12
+ # Install types and save in package.json as a development dependency
13
+ npm install @microsoft/microsoft-graph-types --save-dev
14
+
15
+ ```
16
+
17
+
18
+ ![此 GIF 显示了 Visual Studio Code 中的 Microsoft Graph 实体的智能感知和自动完成](https://github.com/microsoftgraph/msgraph-typescript-typings/raw/master/typings-demo.gif)
19
+ ## 示例
20
+ 以下示例假定你拥有有效的访问令牌。我们使用了 [isomorphic-fetch](https://www.npmjs.com/package/isomorphic-fetch) 执行请求,但你也可以使用[我们的 JavaScript 客户端库](https://github.com/microsoftgraph/msgraph-sdk-javascript)或其他库。
21
+ ```typescript
22
+ import * as MicrosoftGraph from "@microsoft/microsoft-graph-types"
23
+
24
+ import * from 'isomorphic-fetch';
25
+ const accessToken:string = "";
26
+ ```
27
+ ### 列出最近的邮件
28
+ ```typescript
29
+ let url = "https://graph.microsoft.com/v1.0/me/messages";
30
+ let request = new Request(url, {
31
+ method: "GET",
32
+ headers: new Headers({
33
+ "Authorization": "Bearer " + accessToken
34
+ })
35
+ });
36
+
37
+ fetch(request)
38
+ .then((response) => {
39
+ response.json().then((res) => {
40
+ let messages:[MicrosoftGraph.Message] = res.value;
41
+ for (let msg of messages) { //iterate through the recent messages
42
+ console.log(msg.subject);
43
+ console.log(msg.toRecipients[0].emailAddress.address);
44
+ }
45
+ });
46
+
47
+ })
48
+ .catch((error) => {
49
+ console.error(error);
50
+ });
51
+ ```
52
+ ### 使用已登录用户的身份发送电子邮件
53
+ ```typescript
54
+ // Create the message object
55
+
56
+ // Note that all the properties must follow the interface definitions.
57
+ // For example, this will not compile if you try to type "xml" instead of "html" for contentType.
58
+
59
+ let mail:MicrosoftGraph.Message = {
60
+ subject: "Microsoft Graph TypeScript Sample",
61
+ toRecipients: [{
62
+ emailAddress: {
63
+ address: "microsoftgraph@example.com"
64
+ }
65
+ }],
66
+ body: {
67
+ content: "<h1>Microsoft Graph TypeScript Sample</h1>Try modifying the sample",
68
+ contentType: "html"
69
+ }
70
+ }
71
+ // send the email by sending a POST request to the Microsoft Graph
72
+ let url = "https://graph.microsoft.com/v1.0/users/me/sendMail";
73
+ let request = new Request(
74
+ url, {
75
+ method: "POST",
76
+ body: JSON.stringify({
77
+ message: mail
78
+ }),
79
+ headers: new Headers({
80
+ "Authorization": "Bearer " + accessToken,
81
+ 'Content-Type': 'application/json'
82
+ })
83
+ }
84
+ );
85
+
86
+ fetch(request)
87
+ .then((response) => {
88
+ if(response.ok === true) {
89
+ console.log("Mail sent successfully..!!");
90
+ }
91
+ })
92
+ .catch((err) => {
93
+ console.error(err);
94
+ });
95
+
96
+ ```
97
+ ## Microsoft Graph 测试版支持
98
+ 如果要测试 Microsoft Graph 测试版终结点,可将这些类型与 v1.0 类型同时使用。
99
+
100
+ 使用以下内容更新你的 package.json 文件:
101
+
102
+ ```javascript
103
+ "devDependencies": {
104
+ // import published v1.0 types with a version from NPM
105
+ "@microsoft/microsoft-graph-types": "^0.4.0",
106
+
107
+ // import beta types from the beta branch on the GitHub repo
108
+ "@microsoft/microsoft-graph-types-beta": "microsoftgraph/msgraph-typescript-typings#beta"
109
+ }
110
+ }
111
+ ```
112
+
113
+ 从 `@microsoft/microsoft-graph-types-beta` 导入测试版类型
114
+ ```typescript
115
+ // import individual entities
116
+ import {User as BetaUser} from "@microsoft/microsoft-graph-types-beta"
117
+
118
+ // or import everything under MicrosoftGraphBeta
119
+ import * as MicrosoftGraphBeta from "@microsoft/microsoft-graph-types-beta"
120
+ ```
121
+
122
+ ## 支持的编辑器
123
+ 当至少使用 TypeScript 2.0 时,任何 TypeScript 项目都可以使用这些类型。我们已测试在以下编辑器中包含这些类型作为依赖项。
124
+ * Visual Studio Code
125
+ * WebStorm
126
+ * 带有 [atom-typescript](https://atom.io/packages/atom-typescript) 插件的 Atom
127
+
128
+ ## 问题和意见
129
+
130
+ 我们非常乐意倾听你对于 TypeScript 定义项目的反馈。你可通过该存储库中的[问题](https://github.com/microsoftgraph/msgraph-typescript-typings/issues)部分向我们发送问题和建议。
131
+
132
+
133
+ ## 参与
134
+ 请参阅[参与指南](CONTRIBUTING.md)。
135
+
136
+ ## 其他资源
137
+
138
+ * [Microsoft Graph](https://graph.microsoft.io)
139
+ * [Office 开发人员中心](http://dev.office.com/)
140
+ * [Microsoft Graph JavaScript 客户端库](https://github.com/microsoftgraph/msgraph-sdk-javascript)
141
+
142
+ ## 安全报告
143
+
144
+ 如果发现库或服务存在安全问题,请尽可能详细地报告至 [secure@microsoft.com](mailto:secure@microsoft.com)。提交可能有资格通过 [Microsoft 报告奖励](http://aka.ms/bugbounty)计划获得奖励。请勿发布安全问题至 GitHub 问题或其他任何公共网站。我们将在收到信息后立即与你联系。建议发生安全事件时获取相关通知,方法是访问[此页](https://technet.microsoft.com/en-us/security/dd252948)并订阅“安全公告通知”。
145
+
146
+ ## 许可证
147
+
148
+ 版权所有 (c) Microsoft Corporation。保留所有权利。根据 MIT 许可证(简称“许可证”)获得许可。
149
+
150
+ ## 我们重视并遵守“Microsoft 开放源代码行为准则”
151
+
152
+ 此项目已采用 [Microsoft 开放源代码行为准则](https://opensource.microsoft.com/codeofconduct/)。有关详细信息,请参阅[行为准则常见问题解答](https://opensource.microsoft.com/codeofconduct/faq/)。如有其他任何问题或意见,也可联系 [opencode@microsoft.com](mailto:opencode@microsoft.com)。