Die APIs unter der /beta Version in Microsoft Graph können sich ändern. Die Verwendung dieser APIs in Produktionsanwendungen wird nicht unterstützt. Um festzustellen, ob eine API in v1.0 verfügbar ist, verwenden Sie die Version Selektor.
Verwenden Sie diese API zum Erstellen eines neuen Ereignisses in einem Kalender. Dies kann ein Kalender für einen Benutzer oder der Standardkalender einer Microsoft 365-Gruppe sein.
Je nach dem Typ des Kalenders, in dem das Ereignis erstellt wird, und dem Typ der Berechtigung (delegierte Berechtigung oder Anwendungsberechtigung), ist eine der folgenden Berechtigungen erforderlich, um diese API aufzurufen. Weitere Informationen, unter anderem zur Auswahl von Berechtigungen, finden Sie unter Berechtigungen.
Kalender
Delegiert (Geschäfts-, Schul- oder Unikonto)
Delegiert (persönliches Microsoft-Konto)
Application
Benutzerkalender
Calendars.ReadWrite
Calendars.ReadWrite
Calendars.ReadWrite
Gruppenkalender
Group.ReadWrite.All
Nicht unterstützt
Nicht unterstützt
HTTP-Anforderung
Der Standardkalender eines Benutzers oder einer Gruppe.
POST /me/calendar/events
POST /users/{id | userPrincipalName}/calendar/events
POST /groups/{id}/calendar/events
POST https://graph.microsoft.com/beta/me/calendars/AAMkAGViNDU7zAAAAAGtlAAA=/events
Content-type: application/json
{
"subject": "Let's go for lunch",
"body": {
"contentType": "HTML",
"content": "Does next month work for you?"
},
"start": {
"dateTime": "2019-03-10T12:00:00",
"timeZone": "Pacific Standard Time"
},
"end": {
"dateTime": "2019-03-10T14:00:00",
"timeZone": "Pacific Standard Time"
},
"location":{
"displayName":"Harry's Bar"
},
"attendees": [
{
"emailAddress": {
"address":"adelev@contoso.com",
"name": "Adele Vance"
},
"type": "required"
}
],
"transactionId":"7E163156-7762-4BEB-A1C6-729EA81755A7"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new Event
{
Subject = "Let's go for lunch",
Body = new ItemBody
{
ContentType = BodyType.Html,
Content = "Does next month work for you?",
},
Start = new DateTimeTimeZone
{
DateTime = "2019-03-10T12:00:00",
TimeZone = "Pacific Standard Time",
},
End = new DateTimeTimeZone
{
DateTime = "2019-03-10T14:00:00",
TimeZone = "Pacific Standard Time",
},
Location = new Location
{
DisplayName = "Harry's Bar",
},
Attendees = new List<Attendee>
{
new Attendee
{
EmailAddress = new EmailAddress
{
Address = "adelev@contoso.com",
Name = "Adele Vance",
},
Type = AttendeeType.Required,
},
},
TransactionId = "7E163156-7762-4BEB-A1C6-729EA81755A7",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Me.Calendars["{calendar-id}"].Events.PostAsync(requestBody);
Wichtig
Die Microsoft Graph SDKs verwenden standardmäßig die Version v1.0 der API und unterstützen nicht alle Typen, Eigenschaften und APIs, die in der Beta-Version verfügbar sind. Einzelheiten zum Zugriff auf die Beta-API mit dem SDK finden Sie unter Verwenden der Microsoft Graph SDKs mit der Beta-API.
mgc-beta users calendars events create --user-id {user-id} --calendar-id {calendar-id} --body '{\
"subject": "Let's go for lunch",\
"body": {\
"contentType": "HTML",\
"content": "Does next month work for you?"\
},\
"start": {\
"dateTime": "2019-03-10T12:00:00",\
"timeZone": "Pacific Standard Time"\
},\
"end": {\
"dateTime": "2019-03-10T14:00:00",\
"timeZone": "Pacific Standard Time"\
},\
"location":{\
"displayName":"Harry's Bar"\
},\
"attendees": [\
{\
"emailAddress": {\
"address":"adelev@contoso.com",\
"name": "Adele Vance"\
},\
"type": "required"\
}\
],\
"transactionId":"7E163156-7762-4BEB-A1C6-729EA81755A7"\
}\
'
Wichtig
Die Microsoft Graph SDKs verwenden standardmäßig die Version v1.0 der API und unterstützen nicht alle Typen, Eigenschaften und APIs, die in der Beta-Version verfügbar sind. Einzelheiten zum Zugriff auf die Beta-API mit dem SDK finden Sie unter Verwenden der Microsoft Graph SDKs mit der Beta-API.
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewEvent()
subject := "Let's go for lunch"
requestBody.SetSubject(&subject)
body := graphmodels.NewItemBody()
contentType := graphmodels.HTML_BODYTYPE
body.SetContentType(&contentType)
content := "Does next month work for you?"
body.SetContent(&content)
requestBody.SetBody(body)
start := graphmodels.NewDateTimeTimeZone()
dateTime := "2019-03-10T12:00:00"
start.SetDateTime(&dateTime)
timeZone := "Pacific Standard Time"
start.SetTimeZone(&timeZone)
requestBody.SetStart(start)
end := graphmodels.NewDateTimeTimeZone()
dateTime := "2019-03-10T14:00:00"
end.SetDateTime(&dateTime)
timeZone := "Pacific Standard Time"
end.SetTimeZone(&timeZone)
requestBody.SetEnd(end)
location := graphmodels.NewLocation()
displayName := "Harry's Bar"
location.SetDisplayName(&displayName)
requestBody.SetLocation(location)
attendee := graphmodels.NewAttendee()
emailAddress := graphmodels.NewEmailAddress()
address := "adelev@contoso.com"
emailAddress.SetAddress(&address)
name := "Adele Vance"
emailAddress.SetName(&name)
attendee.SetEmailAddress(emailAddress)
type := graphmodels.REQUIRED_ATTENDEETYPE
attendee.SetType(&type)
attendees := []graphmodels.Attendeeable {
attendee,
}
requestBody.SetAttendees(attendees)
transactionId := "7E163156-7762-4BEB-A1C6-729EA81755A7"
requestBody.SetTransactionId(&transactionId)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
events, err := graphClient.Me().Calendars().ByCalendarId("calendar-id").Events().Post(context.Background(), requestBody, nil)
Wichtig
Die Microsoft Graph SDKs verwenden standardmäßig die Version v1.0 der API und unterstützen nicht alle Typen, Eigenschaften und APIs, die in der Beta-Version verfügbar sind. Einzelheiten zum Zugriff auf die Beta-API mit dem SDK finden Sie unter Verwenden der Microsoft Graph SDKs mit der Beta-API.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Event event = new Event();
event.setSubject("Let's go for lunch");
ItemBody body = new ItemBody();
body.setContentType(BodyType.Html);
body.setContent("Does next month work for you?");
event.setBody(body);
DateTimeTimeZone start = new DateTimeTimeZone();
start.setDateTime("2019-03-10T12:00:00");
start.setTimeZone("Pacific Standard Time");
event.setStart(start);
DateTimeTimeZone end = new DateTimeTimeZone();
end.setDateTime("2019-03-10T14:00:00");
end.setTimeZone("Pacific Standard Time");
event.setEnd(end);
Location location = new Location();
location.setDisplayName("Harry's Bar");
event.setLocation(location);
LinkedList<Attendee> attendees = new LinkedList<Attendee>();
Attendee attendee = new Attendee();
EmailAddress emailAddress = new EmailAddress();
emailAddress.setAddress("adelev@contoso.com");
emailAddress.setName("Adele Vance");
attendee.setEmailAddress(emailAddress);
attendee.setType(AttendeeType.Required);
attendees.add(attendee);
event.setAttendees(attendees);
event.setTransactionId("7E163156-7762-4BEB-A1C6-729EA81755A7");
Event result = graphClient.me().calendars().byCalendarId("{calendar-id}").events().post(event);
Wichtig
Die Microsoft Graph SDKs verwenden standardmäßig die Version v1.0 der API und unterstützen nicht alle Typen, Eigenschaften und APIs, die in der Beta-Version verfügbar sind. Einzelheiten zum Zugriff auf die Beta-API mit dem SDK finden Sie unter Verwenden der Microsoft Graph SDKs mit der Beta-API.
Die Microsoft Graph SDKs verwenden standardmäßig die Version v1.0 der API und unterstützen nicht alle Typen, Eigenschaften und APIs, die in der Beta-Version verfügbar sind. Einzelheiten zum Zugriff auf die Beta-API mit dem SDK finden Sie unter Verwenden der Microsoft Graph SDKs mit der Beta-API.
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\Event;
use Microsoft\Graph\Beta\Generated\Models\ItemBody;
use Microsoft\Graph\Beta\Generated\Models\BodyType;
use Microsoft\Graph\Beta\Generated\Models\DateTimeTimeZone;
use Microsoft\Graph\Beta\Generated\Models\Location;
use Microsoft\Graph\Beta\Generated\Models\Attendee;
use Microsoft\Graph\Beta\Generated\Models\EmailAddress;
use Microsoft\Graph\Beta\Generated\Models\AttendeeType;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Event();
$requestBody->setSubject('Let\'s go for lunch');
$body = new ItemBody();
$body->setContentType(new BodyType('hTML'));
$body->setContent('Does next month work for you?');
$requestBody->setBody($body);
$start = new DateTimeTimeZone();
$start->setDateTime('2019-03-10T12:00:00');
$start->setTimeZone('Pacific Standard Time');
$requestBody->setStart($start);
$end = new DateTimeTimeZone();
$end->setDateTime('2019-03-10T14:00:00');
$end->setTimeZone('Pacific Standard Time');
$requestBody->setEnd($end);
$location = new Location();
$location->setDisplayName('Harry\'s Bar');
$requestBody->setLocation($location);
$attendeesAttendee1 = new Attendee();
$attendeesAttendee1EmailAddress = new EmailAddress();
$attendeesAttendee1EmailAddress->setAddress('adelev@contoso.com');
$attendeesAttendee1EmailAddress->setName('Adele Vance');
$attendeesAttendee1->setEmailAddress($attendeesAttendee1EmailAddress);
$attendeesAttendee1->setType(new AttendeeType('required'));
$attendeesArray []= $attendeesAttendee1;
$requestBody->setAttendees($attendeesArray);
$requestBody->setTransactionId('7E163156-7762-4BEB-A1C6-729EA81755A7');
$result = $graphServiceClient->me()->calendars()->byCalendarId('calendar-id')->events()->post($requestBody)->wait();
Wichtig
Die Microsoft Graph SDKs verwenden standardmäßig die Version v1.0 der API und unterstützen nicht alle Typen, Eigenschaften und APIs, die in der Beta-Version verfügbar sind. Einzelheiten zum Zugriff auf die Beta-API mit dem SDK finden Sie unter Verwenden der Microsoft Graph SDKs mit der Beta-API.
Import-Module Microsoft.Graph.Beta.Calendar
$params = @{
subject = "Let's go for lunch"
body = @{
contentType = "HTML"
content = "Does next month work for you?"
}
start = @{
dateTime = "2019-03-10T12:00:00"
timeZone = "Pacific Standard Time"
}
end = @{
dateTime = "2019-03-10T14:00:00"
timeZone = "Pacific Standard Time"
}
location = @{
displayName = "Harry's Bar"
}
attendees = @(
@{
emailAddress = @{
address = "adelev@contoso.com"
name = "Adele Vance"
}
type = "required"
}
)
transactionId = "7E163156-7762-4BEB-A1C6-729EA81755A7"
}
# A UPN can also be used as -UserId.
New-MgBetaUserCalendarEvent -UserId $userId -CalendarId $calendarId -BodyParameter $params
Wichtig
Die Microsoft Graph SDKs verwenden standardmäßig die Version v1.0 der API und unterstützen nicht alle Typen, Eigenschaften und APIs, die in der Beta-Version verfügbar sind. Einzelheiten zum Zugriff auf die Beta-API mit dem SDK finden Sie unter Verwenden der Microsoft Graph SDKs mit der Beta-API.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.event import Event
from msgraph_beta.generated.models.item_body import ItemBody
from msgraph_beta.generated.models.body_type import BodyType
from msgraph_beta.generated.models.date_time_time_zone import DateTimeTimeZone
from msgraph_beta.generated.models.location import Location
from msgraph_beta.generated.models.attendee import Attendee
from msgraph_beta.generated.models.email_address import EmailAddress
from msgraph_beta.generated.models.attendee_type import AttendeeType
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Event(
subject = "Let's go for lunch",
body = ItemBody(
content_type = BodyType.Html,
content = "Does next month work for you?",
),
start = DateTimeTimeZone(
date_time = "2019-03-10T12:00:00",
time_zone = "Pacific Standard Time",
),
end = DateTimeTimeZone(
date_time = "2019-03-10T14:00:00",
time_zone = "Pacific Standard Time",
),
location = Location(
display_name = "Harry's Bar",
),
attendees = [
Attendee(
email_address = EmailAddress(
address = "adelev@contoso.com",
name = "Adele Vance",
),
type = AttendeeType.Required,
),
],
transaction_id = "7E163156-7762-4BEB-A1C6-729EA81755A7",
)
result = await graph_client.me.calendars.by_calendar_id('calendar-id').events.post(request_body)
Wichtig
Die Microsoft Graph SDKs verwenden standardmäßig die Version v1.0 der API und unterstützen nicht alle Typen, Eigenschaften und APIs, die in der Beta-Version verfügbar sind. Einzelheiten zum Zugriff auf die Beta-API mit dem SDK finden Sie unter Verwenden der Microsoft Graph SDKs mit der Beta-API.
POST https://graph.microsoft.com/beta/me/calendars/AAMkAGViNDU8zAAAAAGtlAAA=/events
Content-type: application/json
{
"subject": "Let's go for lunch",
"body": {
"contentType": "HTML",
"content": "Does next month work for you?"
},
"start": {
"dateTime": "2019-03-10T12:00:00",
"timeZone": "Pacific Standard Time"
},
"end": {
"dateTime": "2019-03-10T14:00:00",
"timeZone": "Pacific Standard Time"
},
"location":{
"displayName":"Harry's Bar"
},
"attendees": [
{
"emailAddress": {
"address":"adelev@contoso.com",
"name": "Adele Vance"
},
"type": "required"
}
],
"isOnlineMeeting": true,
"onlineMeetingProvider": "teamsForBusiness"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new Event
{
Subject = "Let's go for lunch",
Body = new ItemBody
{
ContentType = BodyType.Html,
Content = "Does next month work for you?",
},
Start = new DateTimeTimeZone
{
DateTime = "2019-03-10T12:00:00",
TimeZone = "Pacific Standard Time",
},
End = new DateTimeTimeZone
{
DateTime = "2019-03-10T14:00:00",
TimeZone = "Pacific Standard Time",
},
Location = new Location
{
DisplayName = "Harry's Bar",
},
Attendees = new List<Attendee>
{
new Attendee
{
EmailAddress = new EmailAddress
{
Address = "adelev@contoso.com",
Name = "Adele Vance",
},
Type = AttendeeType.Required,
},
},
IsOnlineMeeting = true,
OnlineMeetingProvider = OnlineMeetingProviderType.TeamsForBusiness,
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Me.Calendars["{calendar-id}"].Events.PostAsync(requestBody);
Wichtig
Die Microsoft Graph SDKs verwenden standardmäßig die Version v1.0 der API und unterstützen nicht alle Typen, Eigenschaften und APIs, die in der Beta-Version verfügbar sind. Einzelheiten zum Zugriff auf die Beta-API mit dem SDK finden Sie unter Verwenden der Microsoft Graph SDKs mit der Beta-API.
mgc-beta users calendars events create --user-id {user-id} --calendar-id {calendar-id} --body '{\
"subject": "Let's go for lunch",\
"body": {\
"contentType": "HTML",\
"content": "Does next month work for you?"\
},\
"start": {\
"dateTime": "2019-03-10T12:00:00",\
"timeZone": "Pacific Standard Time"\
},\
"end": {\
"dateTime": "2019-03-10T14:00:00",\
"timeZone": "Pacific Standard Time"\
},\
"location":{\
"displayName":"Harry's Bar"\
},\
"attendees": [\
{\
"emailAddress": {\
"address":"adelev@contoso.com",\
"name": "Adele Vance"\
},\
"type": "required"\
}\
],\
"isOnlineMeeting": true,\
"onlineMeetingProvider": "teamsForBusiness"\
}\
'
Wichtig
Die Microsoft Graph SDKs verwenden standardmäßig die Version v1.0 der API und unterstützen nicht alle Typen, Eigenschaften und APIs, die in der Beta-Version verfügbar sind. Einzelheiten zum Zugriff auf die Beta-API mit dem SDK finden Sie unter Verwenden der Microsoft Graph SDKs mit der Beta-API.
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewEvent()
subject := "Let's go for lunch"
requestBody.SetSubject(&subject)
body := graphmodels.NewItemBody()
contentType := graphmodels.HTML_BODYTYPE
body.SetContentType(&contentType)
content := "Does next month work for you?"
body.SetContent(&content)
requestBody.SetBody(body)
start := graphmodels.NewDateTimeTimeZone()
dateTime := "2019-03-10T12:00:00"
start.SetDateTime(&dateTime)
timeZone := "Pacific Standard Time"
start.SetTimeZone(&timeZone)
requestBody.SetStart(start)
end := graphmodels.NewDateTimeTimeZone()
dateTime := "2019-03-10T14:00:00"
end.SetDateTime(&dateTime)
timeZone := "Pacific Standard Time"
end.SetTimeZone(&timeZone)
requestBody.SetEnd(end)
location := graphmodels.NewLocation()
displayName := "Harry's Bar"
location.SetDisplayName(&displayName)
requestBody.SetLocation(location)
attendee := graphmodels.NewAttendee()
emailAddress := graphmodels.NewEmailAddress()
address := "adelev@contoso.com"
emailAddress.SetAddress(&address)
name := "Adele Vance"
emailAddress.SetName(&name)
attendee.SetEmailAddress(emailAddress)
type := graphmodels.REQUIRED_ATTENDEETYPE
attendee.SetType(&type)
attendees := []graphmodels.Attendeeable {
attendee,
}
requestBody.SetAttendees(attendees)
isOnlineMeeting := true
requestBody.SetIsOnlineMeeting(&isOnlineMeeting)
onlineMeetingProvider := graphmodels.TEAMSFORBUSINESS_ONLINEMEETINGPROVIDERTYPE
requestBody.SetOnlineMeetingProvider(&onlineMeetingProvider)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
events, err := graphClient.Me().Calendars().ByCalendarId("calendar-id").Events().Post(context.Background(), requestBody, nil)
Wichtig
Die Microsoft Graph SDKs verwenden standardmäßig die Version v1.0 der API und unterstützen nicht alle Typen, Eigenschaften und APIs, die in der Beta-Version verfügbar sind. Einzelheiten zum Zugriff auf die Beta-API mit dem SDK finden Sie unter Verwenden der Microsoft Graph SDKs mit der Beta-API.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Event event = new Event();
event.setSubject("Let's go for lunch");
ItemBody body = new ItemBody();
body.setContentType(BodyType.Html);
body.setContent("Does next month work for you?");
event.setBody(body);
DateTimeTimeZone start = new DateTimeTimeZone();
start.setDateTime("2019-03-10T12:00:00");
start.setTimeZone("Pacific Standard Time");
event.setStart(start);
DateTimeTimeZone end = new DateTimeTimeZone();
end.setDateTime("2019-03-10T14:00:00");
end.setTimeZone("Pacific Standard Time");
event.setEnd(end);
Location location = new Location();
location.setDisplayName("Harry's Bar");
event.setLocation(location);
LinkedList<Attendee> attendees = new LinkedList<Attendee>();
Attendee attendee = new Attendee();
EmailAddress emailAddress = new EmailAddress();
emailAddress.setAddress("adelev@contoso.com");
emailAddress.setName("Adele Vance");
attendee.setEmailAddress(emailAddress);
attendee.setType(AttendeeType.Required);
attendees.add(attendee);
event.setAttendees(attendees);
event.setIsOnlineMeeting(true);
event.setOnlineMeetingProvider(OnlineMeetingProviderType.TeamsForBusiness);
Event result = graphClient.me().calendars().byCalendarId("{calendar-id}").events().post(event);
Wichtig
Die Microsoft Graph SDKs verwenden standardmäßig die Version v1.0 der API und unterstützen nicht alle Typen, Eigenschaften und APIs, die in der Beta-Version verfügbar sind. Einzelheiten zum Zugriff auf die Beta-API mit dem SDK finden Sie unter Verwenden der Microsoft Graph SDKs mit der Beta-API.
Die Microsoft Graph SDKs verwenden standardmäßig die Version v1.0 der API und unterstützen nicht alle Typen, Eigenschaften und APIs, die in der Beta-Version verfügbar sind. Einzelheiten zum Zugriff auf die Beta-API mit dem SDK finden Sie unter Verwenden der Microsoft Graph SDKs mit der Beta-API.
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\Event;
use Microsoft\Graph\Beta\Generated\Models\ItemBody;
use Microsoft\Graph\Beta\Generated\Models\BodyType;
use Microsoft\Graph\Beta\Generated\Models\DateTimeTimeZone;
use Microsoft\Graph\Beta\Generated\Models\Location;
use Microsoft\Graph\Beta\Generated\Models\Attendee;
use Microsoft\Graph\Beta\Generated\Models\EmailAddress;
use Microsoft\Graph\Beta\Generated\Models\AttendeeType;
use Microsoft\Graph\Beta\Generated\Models\OnlineMeetingProviderType;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Event();
$requestBody->setSubject('Let\'s go for lunch');
$body = new ItemBody();
$body->setContentType(new BodyType('hTML'));
$body->setContent('Does next month work for you?');
$requestBody->setBody($body);
$start = new DateTimeTimeZone();
$start->setDateTime('2019-03-10T12:00:00');
$start->setTimeZone('Pacific Standard Time');
$requestBody->setStart($start);
$end = new DateTimeTimeZone();
$end->setDateTime('2019-03-10T14:00:00');
$end->setTimeZone('Pacific Standard Time');
$requestBody->setEnd($end);
$location = new Location();
$location->setDisplayName('Harry\'s Bar');
$requestBody->setLocation($location);
$attendeesAttendee1 = new Attendee();
$attendeesAttendee1EmailAddress = new EmailAddress();
$attendeesAttendee1EmailAddress->setAddress('adelev@contoso.com');
$attendeesAttendee1EmailAddress->setName('Adele Vance');
$attendeesAttendee1->setEmailAddress($attendeesAttendee1EmailAddress);
$attendeesAttendee1->setType(new AttendeeType('required'));
$attendeesArray []= $attendeesAttendee1;
$requestBody->setAttendees($attendeesArray);
$requestBody->setIsOnlineMeeting(true);
$requestBody->setOnlineMeetingProvider(new OnlineMeetingProviderType('teamsForBusiness'));
$result = $graphServiceClient->me()->calendars()->byCalendarId('calendar-id')->events()->post($requestBody)->wait();
Wichtig
Die Microsoft Graph SDKs verwenden standardmäßig die Version v1.0 der API und unterstützen nicht alle Typen, Eigenschaften und APIs, die in der Beta-Version verfügbar sind. Einzelheiten zum Zugriff auf die Beta-API mit dem SDK finden Sie unter Verwenden der Microsoft Graph SDKs mit der Beta-API.
Import-Module Microsoft.Graph.Beta.Calendar
$params = @{
subject = "Let's go for lunch"
body = @{
contentType = "HTML"
content = "Does next month work for you?"
}
start = @{
dateTime = "2019-03-10T12:00:00"
timeZone = "Pacific Standard Time"
}
end = @{
dateTime = "2019-03-10T14:00:00"
timeZone = "Pacific Standard Time"
}
location = @{
displayName = "Harry's Bar"
}
attendees = @(
@{
emailAddress = @{
address = "adelev@contoso.com"
name = "Adele Vance"
}
type = "required"
}
)
isOnlineMeeting = $true
onlineMeetingProvider = "teamsForBusiness"
}
# A UPN can also be used as -UserId.
New-MgBetaUserCalendarEvent -UserId $userId -CalendarId $calendarId -BodyParameter $params
Wichtig
Die Microsoft Graph SDKs verwenden standardmäßig die Version v1.0 der API und unterstützen nicht alle Typen, Eigenschaften und APIs, die in der Beta-Version verfügbar sind. Einzelheiten zum Zugriff auf die Beta-API mit dem SDK finden Sie unter Verwenden der Microsoft Graph SDKs mit der Beta-API.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.event import Event
from msgraph_beta.generated.models.item_body import ItemBody
from msgraph_beta.generated.models.body_type import BodyType
from msgraph_beta.generated.models.date_time_time_zone import DateTimeTimeZone
from msgraph_beta.generated.models.location import Location
from msgraph_beta.generated.models.attendee import Attendee
from msgraph_beta.generated.models.email_address import EmailAddress
from msgraph_beta.generated.models.attendee_type import AttendeeType
from msgraph_beta.generated.models.online_meeting_provider_type import OnlineMeetingProviderType
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Event(
subject = "Let's go for lunch",
body = ItemBody(
content_type = BodyType.Html,
content = "Does next month work for you?",
),
start = DateTimeTimeZone(
date_time = "2019-03-10T12:00:00",
time_zone = "Pacific Standard Time",
),
end = DateTimeTimeZone(
date_time = "2019-03-10T14:00:00",
time_zone = "Pacific Standard Time",
),
location = Location(
display_name = "Harry's Bar",
),
attendees = [
Attendee(
email_address = EmailAddress(
address = "adelev@contoso.com",
name = "Adele Vance",
),
type = AttendeeType.Required,
),
],
is_online_meeting = True,
online_meeting_provider = OnlineMeetingProviderType.TeamsForBusiness,
)
result = await graph_client.me.calendars.by_calendar_id('calendar-id').events.post(request_body)
Wichtig
Die Microsoft Graph SDKs verwenden standardmäßig die Version v1.0 der API und unterstützen nicht alle Typen, Eigenschaften und APIs, die in der Beta-Version verfügbar sind. Einzelheiten zum Zugriff auf die Beta-API mit dem SDK finden Sie unter Verwenden der Microsoft Graph SDKs mit der Beta-API.