onlineMeeting:createOrGet
本文内容
命名空间:microsoft.graph
重要
Microsoft Graph版本下的 /beta API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
创建具有自定义指定外部 ID 的 onlineMeeting 对象。 如果外部 ID 已存在,此 API 将返回具有该外部 ID 的 onlineMeeting 对象。
注释 :会议不会显示在用户的日历上。
权限
要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限 。
权限类型
权限(从最低特权到最高特权)
委派(工作或学校帐户)
OnlineMeetings.ReadWrite
委派(个人 Microsoft 帐户)
不支持。
应用程序
OnlineMeetings.ReadWrite.All*
重要
*管理员必须创建应用程序访问 策略并授予用户,授权策略中配置的应用代表该用户创建或获取具有外部 ID 的联机会议 (请求路径) 中指定的用户 ID。
HTTP 请求
使用委派 令牌调用 createOrGet API:
POST /me/onlineMeetings/createOrGet
使用应用程序 令牌调用 createOrGet API:
POST /users/{userId}/onlineMeetings/createOrGet
名称
说明
Authorization
Bearer {token}。必需。
Content-type
application/json. Required.
请求正文
在请求正文中,提供具有以下参数的 JSON 对象。
参数
类型
说明
chatInfo
chatInfo
与此联机会议关联的聊天信息。
endDateTime
DateTime
会议结束时间(UTC)。
externalId
String
外部 ID。 自定义 ID。 (必需)
participants
meetingParticipants
与联机会议关联的参与者。 这包括组织者和与会者。
startDateTime
DateTime
会议开始时间(UTC)。
subject
String
联机会议的主题。
注意:
如果未 提供 startDateTime 和 endDateTime , startDateTime 将默认为当前 dateTime 值, endDateTime 值将等于 startDateTime + 1 小时。
如果 提供了 startDateTime ,但 endDateTime 未提供, 则 endDateTime 值将等于 startDateTime + 1 小时。
如果在未提供 startDateTime 的情况下提供 endDateTime ,或者 endDateTime 早于 startDateTime,将引发错误 。
目前 ,仅测试版支持 chatInfo 。
响应
如果成功,此方法在新建 201 Created 会议时 200 OK 返回 响应代码,如果检索到现有会议,则返回 响应代码。 在这两种情况下,在响应正文中返回 onlineMeeting 对象。
示例
示例 1:创建或获取具有外部 ID 的联机会议
请求
POST https://graph.microsoft.com/beta/me/onlineMeetings/createOrGet
Content-Type: application/json
{
"startDateTime": "2020-02-06T01:49:21.3524945+00:00",
"endDateTime": "2020-02-06T02:19:21.3524945+00:00",
"subject": "Create a meeting with customId provided",
"externalId": "7eb8263f-d0e0-4149-bb1c-1f0476083c56",
"participants": {
"attendees": [
{
"identity": {
"user": {
"id": "1f35f2e6-9cab-44ad-8d5a-b74c14720000"
}
},
"role": "presenter",
"upn": "test1@contoso.com"
}
]
}
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var startDateTime = DateTimeOffset.Parse("2020-02-06T01:49:21.3524945+00:00");
var endDateTime = DateTimeOffset.Parse("2020-02-06T02:19:21.3524945+00:00");
var subject = "Create a meeting with customId provided";
var externalId = "7eb8263f-d0e0-4149-bb1c-1f0476083c56";
var participants = new MeetingParticipants
{
Attendees = new List<MeetingParticipantInfo>()
{
new MeetingParticipantInfo
{
Identity = new IdentitySet
{
User = new Identity
{
Id = "1f35f2e6-9cab-44ad-8d5a-b74c14720000"
}
},
Role = OnlineMeetingRole.Presenter,
Upn = "test1@contoso.com"
}
}
};
await graphClient.Me.OnlineMeetings
.CreateOrGet(externalId,null,endDateTime,participants,startDateTime,subject)
.Request()
.PostAsync();
const options = {
authProvider,
};
const client = Client.init(options);
const onlineMeeting = {
startDateTime: '2020-02-06T01:49:21.3524945+00:00',
endDateTime: '2020-02-06T02:19:21.3524945+00:00',
subject: 'Create a meeting with customId provided',
externalId: '7eb8263f-d0e0-4149-bb1c-1f0476083c56',
participants: {
attendees: [
{
identity: {
user: {
id: '1f35f2e6-9cab-44ad-8d5a-b74c14720000'
}
},
role: 'presenter',
upn: 'test1@contoso.com'
}
]
}
};
await client.api('/me/onlineMeetings/createOrGet')
.version('beta')
.post(onlineMeeting);
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/beta/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/me/onlineMeetings/createOrGet"]]];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
NSMutableDictionary *payloadDictionary = [[NSMutableDictionary alloc] init];
NSString *startDateTimeDateTimeString = @"02/06/2020 01:49:21";
NSDate *startDateTime = [NSDate ms_dateFromString: startDateTimeDateTimeString];
payloadDictionary[@"startDateTime"] = startDateTime;
NSString *endDateTimeDateTimeString = @"02/06/2020 02:19:21";
NSDate *endDateTime = [NSDate ms_dateFromString: endDateTimeDateTimeString];
payloadDictionary[@"endDateTime"] = endDateTime;
NSString *subject = @"Create a meeting with customId provided";
payloadDictionary[@"subject"] = subject;
NSString *externalId = @"7eb8263f-d0e0-4149-bb1c-1f0476083c56";
payloadDictionary[@"externalId"] = externalId;
MSGraphMeetingParticipants *participants = [[MSGraphMeetingParticipants alloc] init];
NSMutableArray *attendeesList = [[NSMutableArray alloc] init];
MSGraphMeetingParticipantInfo *attendees = [[MSGraphMeetingParticipantInfo alloc] init];
MSGraphIdentitySet *identity = [[MSGraphIdentitySet alloc] init];
MSGraphIdentity *user = [[MSGraphIdentity alloc] init];
[user setId:@"1f35f2e6-9cab-44ad-8d5a-b74c14720000"];
[identity setUser:user];
[attendees setIdentity:identity];
[attendees setRole: [MSGraphOnlineMeetingRole presenter]];
[attendees setUpn:@"test1@contoso.com"];
[attendeesList addObject: attendees];
[participants setAttendees:attendeesList];
payloadDictionary[@"participants"] = participants;
NSData *data = [NSJSONSerialization dataWithJSONObject:payloadDictionary options:kNilOptions error:&error];
[urlRequest setHTTPBody:data];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
OffsetDateTime startDateTime = OffsetDateTimeSerializer.deserialize("02/06/2020 01:49:21");
OffsetDateTime endDateTime = OffsetDateTimeSerializer.deserialize("02/06/2020 02:19:21");
String subject = "Create a meeting with customId provided";
String externalId = "7eb8263f-d0e0-4149-bb1c-1f0476083c56";
MeetingParticipants participants = new MeetingParticipants();
LinkedList<MeetingParticipantInfo> attendeesList = new LinkedList<MeetingParticipantInfo>();
MeetingParticipantInfo attendees = new MeetingParticipantInfo();
IdentitySet identity = new IdentitySet();
Identity user = new Identity();
user.id = "1f35f2e6-9cab-44ad-8d5a-b74c14720000";
identity.user = user;
attendees.identity = identity;
attendees.role = OnlineMeetingRole.PRESENTER;
attendees.upn = "test1@contoso.com";
attendeesList.add(attendees);
participants.attendees = attendeesList;
graphClient.me().onlineMeetings()
.createOrGet(OnlineMeetingCreateOrGetParameterSet
.newBuilder()
.withChatInfo(null)
.withEndDateTime(endDateTime)
.withExternalId(externalId)
.withParticipants(participants)
.withStartDateTime(startDateTime)
.withSubject(subject)
.build())
.buildRequest()
.post();
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := msgraphsdk.New()
startDateTime, err := time.Parse(time.RFC3339, "2020-02-06T01:49:21.3524945+00:00")
requestBody.SetStartDateTime(&startDateTime)
endDateTime, err := time.Parse(time.RFC3339, "2020-02-06T02:19:21.3524945+00:00")
requestBody.SetEndDateTime(&endDateTime)
subject := "Create a meeting with customId provided"
requestBody.SetSubject(&subject)
externalId := "7eb8263f-d0e0-4149-bb1c-1f0476083c56"
requestBody.SetExternalId(&externalId)
participants := msgraphsdk.NewMeetingParticipants()
requestBody.SetParticipants(participants)
participants.SetAttendees( []MeetingParticipantInfo {
msgraphsdk.NewMeetingParticipantInfo(),
identity := msgraphsdk.NewIdentitySet()
SetIdentity(identity)
user := msgraphsdk.NewIdentity()
identity.SetUser(user)
id := "1f35f2e6-9cab-44ad-8d5a-b74c14720000"
user.SetId(&id)
role := "presenter"
SetRole(&role)
upn := "test1@contoso.com"
SetUpn(&upn)
}
result, err := graphClient.Me().OnlineMeetings().CreateOrGet().Post(requestBody)
Import-Module Microsoft.Graph.Users.Actions
$params = @{
StartDateTime = [System.DateTime]::Parse("2020-02-06T01:49:21.3524945+00:00")
EndDateTime = [System.DateTime]::Parse("2020-02-06T02:19:21.3524945+00:00")
Subject = "Create a meeting with customId provided"
ExternalId = "7eb8263f-d0e0-4149-bb1c-1f0476083c56"
Participants = @{
Attendees = @(
@{
Identity = @{
User = @{
Id = "1f35f2e6-9cab-44ad-8d5a-b74c14720000"
}
}
Role = "presenter"
Upn = "test1@contoso.com"
}
)
}
}
# A UPN can also be used as -UserId.
Invoke-MgCreateOrGetUserOnlineMeeting -UserId $userId -BodyParameter $params
响应
注意: 为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": "(redacted)",
"creationDateTime": "2020-09-11T06:30:18.1909168Z",
"startDateTime": "2020-09-11T06:30:18.0615989Z",
"endDateTime": "2020-09-11T07:30:18.0615989Z",
"joinWebUrl": "(redacted)",
"subject": "Create a meeting with customId provided",
"isBroadcast": false,
"autoAdmittedUsers": "EveryoneInCompany",
"isEntryExitAnnounced": true,
"allowedPresenters": "everyone",
"videoTeleconferenceId": "(redacted)",
"externalId": "7eb8263f-d0e0-4149-bb1c-1f0476083c56",
"participants": {
"organizer": {
"upn": "(redacted)",
"role": "presenter",
"identity": {
"user": {
"id": "(redacted)",
}
}
},
"attendees": [
{
"upn": "test1@contoso.com",
"role": null,
"identity": {
"user": {
"id": "1f35f2e6-9cab-44ad-8d5a-b74c14720000",
}
}
}
],
"producers": [],
"contributors": []
},
"lobbyBypassSettings": {
"scope": "organization",
"isDialInBypassEnabled": false
},
"audioConferencing": {
"conferenceId": "(redacted)",
"tollNumber": "+1 206-485-3005",
"tollFreeNumber": null,
"dialinUrl": "https://dialin.teams.microsoft.com/0e73a853-1cc2-436c-b18c-9f53e0a97c24?id=(redacted)"
},
"chatInfo": {
"threadId": "19:7ebda77322dd4505ac4dedb5b67df076@thread.tacv2",
"messageId": "0",
"replyChainMessageId": null
},
}
示例 2:在具有外部 ID 的 Microsoft Teams 频道创建或获取联机会议
请求
POST https://graph.microsoft.com/beta/me/onlineMeetings/createOrGet
Content-Type: application/json
{
"chatInfo": {
"threadId": "19:7ebda77322dd4505ac4dedb5b67df076@thread.tacv2"
},
"startDateTime": "2020-02-06T01:49:21.3524945+00:00",
"endDateTime": "2020-02-06T02:19:21.3524945+00:00",
"externalId": "7eb8263f-d0e0-4149-bb1c-1f0476083c56",
"participants": {
"attendees": [
{
"identity": {
"user": {
"id": "1f35f2e6-9cab-44ad-8d5a-b74c14720000"
}
},
"upn": "test1@contoso.com"
}
]
},
"subject": "Create a meeting with customId provided"
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var chatInfo = new ChatInfo
{
ThreadId = "19:7ebda77322dd4505ac4dedb5b67df076@thread.tacv2"
};
var startDateTime = DateTimeOffset.Parse("2020-02-06T01:49:21.3524945+00:00");
var endDateTime = DateTimeOffset.Parse("2020-02-06T02:19:21.3524945+00:00");
var externalId = "7eb8263f-d0e0-4149-bb1c-1f0476083c56";
var participants = new MeetingParticipants
{
Attendees = new List<MeetingParticipantInfo>()
{
new MeetingParticipantInfo
{
Identity = new IdentitySet
{
User = new Identity
{
Id = "1f35f2e6-9cab-44ad-8d5a-b74c14720000"
}
},
Upn = "test1@contoso.com"
}
}
};
var subject = "Create a meeting with customId provided";
await graphClient.Me.OnlineMeetings
.CreateOrGet(externalId,chatInfo,endDateTime,participants,startDateTime,subject)
.Request()
.PostAsync();
const options = {
authProvider,
};
const client = Client.init(options);
const onlineMeeting = {
chatInfo: {
threadId: '19:7ebda77322dd4505ac4dedb5b67df076@thread.tacv2'
},
startDateTime: '2020-02-06T01:49:21.3524945+00:00',
endDateTime: '2020-02-06T02:19:21.3524945+00:00',
externalId: '7eb8263f-d0e0-4149-bb1c-1f0476083c56',
participants: {
attendees: [
{
identity: {
user: {
id: '1f35f2e6-9cab-44ad-8d5a-b74c14720000'
}
},
upn: 'test1@contoso.com'
}
]
},
subject: 'Create a meeting with customId provided'
};
await client.api('/me/onlineMeetings/createOrGet')
.version('beta')
.post(onlineMeeting);
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/beta/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/me/onlineMeetings/createOrGet"]]];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
NSMutableDictionary *payloadDictionary = [[NSMutableDictionary alloc] init];
MSGraphChatInfo *chatInfo = [[MSGraphChatInfo alloc] init];
[chatInfo setThreadId:@"19:7ebda77322dd4505ac4dedb5b67df076@thread.tacv2"];
payloadDictionary[@"chatInfo"] = chatInfo;
NSString *startDateTimeDateTimeString = @"02/06/2020 01:49:21";
NSDate *startDateTime = [NSDate ms_dateFromString: startDateTimeDateTimeString];
payloadDictionary[@"startDateTime"] = startDateTime;
NSString *endDateTimeDateTimeString = @"02/06/2020 02:19:21";
NSDate *endDateTime = [NSDate ms_dateFromString: endDateTimeDateTimeString];
payloadDictionary[@"endDateTime"] = endDateTime;
NSString *externalId = @"7eb8263f-d0e0-4149-bb1c-1f0476083c56";
payloadDictionary[@"externalId"] = externalId;
MSGraphMeetingParticipants *participants = [[MSGraphMeetingParticipants alloc] init];
NSMutableArray *attendeesList = [[NSMutableArray alloc] init];
MSGraphMeetingParticipantInfo *attendees = [[MSGraphMeetingParticipantInfo alloc] init];
MSGraphIdentitySet *identity = [[MSGraphIdentitySet alloc] init];
MSGraphIdentity *user = [[MSGraphIdentity alloc] init];
[user setId:@"1f35f2e6-9cab-44ad-8d5a-b74c14720000"];
[identity setUser:user];
[attendees setIdentity:identity];
[attendees setUpn:@"test1@contoso.com"];
[attendeesList addObject: attendees];
[participants setAttendees:attendeesList];
payloadDictionary[@"participants"] = participants;
NSString *subject = @"Create a meeting with customId provided";
payloadDictionary[@"subject"] = subject;
NSData *data = [NSJSONSerialization dataWithJSONObject:payloadDictionary options:kNilOptions error:&error];
[urlRequest setHTTPBody:data];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
ChatInfo chatInfo = new ChatInfo();
chatInfo.threadId = "19:7ebda77322dd4505ac4dedb5b67df076@thread.tacv2";
OffsetDateTime startDateTime = OffsetDateTimeSerializer.deserialize("02/06/2020 01:49:21");
OffsetDateTime endDateTime = OffsetDateTimeSerializer.deserialize("02/06/2020 02:19:21");
String externalId = "7eb8263f-d0e0-4149-bb1c-1f0476083c56";
MeetingParticipants participants = new MeetingParticipants();
LinkedList<MeetingParticipantInfo> attendeesList = new LinkedList<MeetingParticipantInfo>();
MeetingParticipantInfo attendees = new MeetingParticipantInfo();
IdentitySet identity = new IdentitySet();
Identity user = new Identity();
user.id = "1f35f2e6-9cab-44ad-8d5a-b74c14720000";
identity.user = user;
attendees.identity = identity;
attendees.upn = "test1@contoso.com";
attendeesList.add(attendees);
participants.attendees = attendeesList;
String subject = "Create a meeting with customId provided";
graphClient.me().onlineMeetings()
.createOrGet(OnlineMeetingCreateOrGetParameterSet
.newBuilder()
.withChatInfo(chatInfo)
.withEndDateTime(endDateTime)
.withExternalId(externalId)
.withParticipants(participants)
.withStartDateTime(startDateTime)
.withSubject(subject)
.build())
.buildRequest()
.post();
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := msgraphsdk.New()
chatInfo := msgraphsdk.NewChatInfo()
requestBody.SetChatInfo(chatInfo)
threadId := "19:7ebda77322dd4505ac4dedb5b67df076@thread.tacv2"
chatInfo.SetThreadId(&threadId)
startDateTime, err := time.Parse(time.RFC3339, "2020-02-06T01:49:21.3524945+00:00")
requestBody.SetStartDateTime(&startDateTime)
endDateTime, err := time.Parse(time.RFC3339, "2020-02-06T02:19:21.3524945+00:00")
requestBody.SetEndDateTime(&endDateTime)
externalId := "7eb8263f-d0e0-4149-bb1c-1f0476083c56"
requestBody.SetExternalId(&externalId)
participants := msgraphsdk.NewMeetingParticipants()
requestBody.SetParticipants(participants)
participants.SetAttendees( []MeetingParticipantInfo {
msgraphsdk.NewMeetingParticipantInfo(),
identity := msgraphsdk.NewIdentitySet()
SetIdentity(identity)
user := msgraphsdk.NewIdentity()
identity.SetUser(user)
id := "1f35f2e6-9cab-44ad-8d5a-b74c14720000"
user.SetId(&id)
upn := "test1@contoso.com"
SetUpn(&upn)
}
subject := "Create a meeting with customId provided"
requestBody.SetSubject(&subject)
result, err := graphClient.Me().OnlineMeetings().CreateOrGet().Post(requestBody)
Import-Module Microsoft.Graph.Users.Actions
$params = @{
ChatInfo = @{
ThreadId = "19:7ebda77322dd4505ac4dedb5b67df076@thread.tacv2"
}
StartDateTime = [System.DateTime]::Parse("2020-02-06T01:49:21.3524945+00:00")
EndDateTime = [System.DateTime]::Parse("2020-02-06T02:19:21.3524945+00:00")
ExternalId = "7eb8263f-d0e0-4149-bb1c-1f0476083c56"
Participants = @{
Attendees = @(
@{
Identity = @{
User = @{
Id = "1f35f2e6-9cab-44ad-8d5a-b74c14720000"
}
}
Upn = "test1@contoso.com"
}
)
}
Subject = "Create a meeting with customId provided"
}
# A UPN can also be used as -UserId.
Invoke-MgCreateOrGetUserOnlineMeeting -UserId $userId -BodyParameter $params
响应
注意: 为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": "(redacted)",
"creationDateTime": "2020-09-11T06:30:18.1909168Z",
"startDateTime": "2020-09-11T06:30:18.0615989Z",
"endDateTime": "2020-09-11T07:30:18.0615989Z",
"joinWebUrl": "(redacted)",
"subject": "Create a meeting with customId provided",
"isBroadcast": false,
"autoAdmittedUsers": "EveryoneInCompany",
"isEntryExitAnnounced": true,
"allowedPresenters": "everyone",
"videoTeleconferenceId": "(redacted)",
"externalId": "7eb8263f-d0e0-4149-bb1c-1f0476083c56",
"participants": {
"organizer": {
"upn": "(redacted)",
"role": "presenter",
"identity": {
"user": {
"id": "(redacted)",
}
}
},
"attendees": [
{
"upn": "test1@contoso.com",
"role": null,
"identity": {
"user": {
"id": "1f35f2e6-9cab-44ad-8d5a-b74c14720000",
}
}
}
],
"producers": [],
"contributors": []
},
"lobbyBypassSettings": {
"scope": "organization",
"isDialInBypassEnabled": false
},
"audioConferencing": {
"conferenceId": "(redacted)",
"tollNumber": "+1 206-485-3005",
"tollFreeNumber": null,
"dialinUrl": "https://dialin.teams.microsoft.com/0e73a853-1cc2-436c-b18c-9f53e0a97c24?id=(redacted)"
},
"chatInfo": {
"threadId": "19:7ebda77322dd4505ac4dedb5b67df076@thread.tacv2",
"messageId": "1599805818399",
"replyChainMessageId": null
},
}