Kalender erstellenCreate Calendar
Namespace: microsoft.graphNamespace: microsoft.graph
Verwenden Sie diese API zum Erstellen eines neuen Kalenders für einen Benutzer.Use this API to create a new calendar for a user.
BerechtigungenPermissions
Eine der nachfolgenden Berechtigungen ist erforderlich, um diese API aufrufen zu können. Weitere Informationen, unter anderem zur Auswahl von Berechtigungen, finden Sie im Artikel zum Thema Berechtigungen.One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.
BerechtigungstypPermission type | Berechtigungen (von der Berechtigung mit den wenigsten Rechten zu der mit den meisten Rechten)Permissions (from least to most privileged) |
---|---|
Delegiert (Geschäfts-, Schul- oder Unikonto)Delegated (work or school account) | Calendars.ReadWriteCalendars.ReadWrite |
Delegiert (persönliches Microsoft-Konto)Delegated (personal Microsoft account) | Calendars.ReadWriteCalendars.ReadWrite |
AnwendungApplication | Calendars.ReadWriteCalendars.ReadWrite |
HTTP-AnforderungHTTP request
POST /me/calendars
POST /users/{id | userPrincipalName}/calendars
AnforderungsheaderRequest headers
KopfzeileHeader | WertValue |
---|---|
AuthorizationAuthorization | Bearer {token}. Erforderlich.Bearer {token}. Required. |
Content-TypeContent-Type | application/jsonapplication/json |
AnforderungstextRequest body
Geben Sie im Anforderungstext eine JSON-Darstellung des calendar-Objekts an.In the request body, supply a JSON representation of calendar object.
AntwortResponse
Wenn die Methode erfolgreich verläuft, werden der Antwortcode 201 Created
und ein calendar-Objekt im Antworttext zurückgegeben.If successful, this method returns 201 Created
response code and calendar object in the response body.
BeispielExample
AnforderungRequest
Nachfolgend sehen Sie ein Beispiel der Anforderung.Here is an example of the request.
POST https://graph.microsoft.com/v1.0/me/calendars
Content-type: application/json
{
"name": "Volunteer"
}
Geben Sie im Anforderungstext eine JSON-Darstellung des calendar-Objekts an.In the request body, supply a JSON representation of calendar object.
AntwortResponse
Nachfolgend sehen Sie ein Beispiel der Antwort. Hinweis: Das hier gezeigte Antwortobjekt ist möglicherweise aus Platzgründen abgeschnitten. Von einem tatsächlichen Aufruf werden alle Eigenschaften zurückgegeben.Here is an example of the response. Note: The response object shown here may be truncated for brevity. All of the properties will be returned from an actual call.
HTTP/1.1 201 Created
Content-type: application/json
{
"@odata.context":"https://graph.microsoft.com/v1.0/$metadata#me/calendars/$entity",
"@odata.id":"https://graph.microsoft.com/v1.0/users('266efe5a-0fd7-4edd-877b-b2d1e561f193@ae01a323-3934-4475-a32d-af1274312bb0')/calendars('AAMkADJmMVAAA=')",
"id":"AAMkADJmMVAAA=",
"name":"Volunteer",
"color":"auto",
"changeKey":"DxYSthXJXEWwAQSYQnXvIgAAIxGttg==",
"canShare":true,
"canViewPrivateItems":true,
"hexColor": "",
"canEdit":true,
"allowedOnlineMeetingProviders": [
"teamsForBusiness"
],
"defaultOnlineMeetingProvider": "teamsForBusiness",
"isTallyingResponses": true,
"isRemovable": false,
"owner":{
"name":"Samantha Booth",
"address":"samanthab@adatum.onmicrosoft.com"
}
}