Skip to content

Commit

Permalink
Sync with latest SDKs, and refresh of documentation. (microsoftgraph#118
Browse files Browse the repository at this point in the history
)

* Sync with latest SDKs, and refresh of documentation.

* Sync with latest samples.
  • Loading branch information
ksikorsk authored Oct 22, 2019
1 parent 70295da commit cfb4964
Show file tree
Hide file tree
Showing 36 changed files with 2,410 additions and 2,157 deletions.
2 changes: 0 additions & 2 deletions Samples/BetaSamples/RemoteMediaSamples/IncidentBot/Bot/Bot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -247,13 +247,11 @@ public async Task<ICall> JoinCallAsync(JoinCallRequestData joinCallBody, string
.ConfigureAwait(false);

meetingInfo = new OrganizerMeetingInfo { Organizer = onlineMeeting.Participants.Organizer.Identity, };
meetingInfo.AllowConversationWithoutHost = joinCallBody.AllowConversationWithoutHost;
chatInfo = onlineMeeting.ChatInfo;
}
else
{
(chatInfo, meetingInfo) = JoinInfo.ParseJoinURL(joinCallBody.JoinURL);
meetingInfo.AllowConversationWithoutHost = joinCallBody.AllowConversationWithoutHost;
}

var tenantId =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,5 @@ public class JoinCallRequestData
/// Gets or sets a value indicating whether to remove the bot from default routing group.
/// </summary>
public bool RemoveFromDefaultRoutingGroup { get; set; }

/// <summary>
/// Gets or sets a value indicating whether allow conversation without host.
/// </summary>
public bool AllowConversationWithoutHost { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<PackageReference Include="Microsoft.AspNetCore.Mvc.WebApiCompatShim" Version="2.1.1" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="2.1.1" />
<PackageReference Include="Microsoft.Graph.Communications.Calls" Version="1.1.0-prerelease.1511" />
<PackageReference Include="Microsoft.Graph.Communications.Calls" Version="1.1.0-prerelease.1855" />
<PackageReference Include="System.Threading.Tasks.Dataflow" Version="4.9.0" />
<ProjectReference Include="..\..\..\Common\Sample.Common\Sample.Common.csproj" />
<Reference Include="System.Net.Http" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
// <copyright file="OnlineMeeting.cs" company="Microsoft Corporation">
// <copyright file="AppOnlineMeeting.cs" company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
// </copyright>

// THIS CODE HAS NOT BEEN TESTED RIGOROUSLY.USING THIS CODE IN PRODUCTION ENVIRONMENT IS STRICTLY NOT RECOMMENDED.
// THIS SAMPLE IS PURELY FOR DEMONSTRATION PURPOSES ONLY.
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND.
namespace Sample.OnlineMeeting
{
using System;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Graph;
Expand All @@ -15,17 +19,17 @@ namespace Sample.OnlineMeeting
/// <summary>
/// Online meeting class to fetch meeting info based of meeting id (ex: vtckey).
/// </summary>
public class OnlineMeeting
public class AppOnlineMeeting
{
private Uri graphEndpointUri;
private IRequestAuthenticationProvider requestAuthenticationProvider;

/// <summary>
/// Initializes a new instance of the <see cref="OnlineMeeting"/> class.
/// Initializes a new instance of the <see cref="AppOnlineMeeting"/> class.
/// </summary>
/// <param name="requestAuthenticationProvider">The request authentication provider.</param>
/// <param name="graphUri">The graph url.</param>
public OnlineMeeting(IRequestAuthenticationProvider requestAuthenticationProvider, Uri graphUri)
public AppOnlineMeeting(IRequestAuthenticationProvider requestAuthenticationProvider, Uri graphUri)
{
this.requestAuthenticationProvider = requestAuthenticationProvider;
this.graphEndpointUri = graphUri;
Expand Down Expand Up @@ -54,13 +58,14 @@ public OnlineMeeting(IRequestAuthenticationProvider requestAuthenticationProvide
}

/// <summary>
/// Creates a new adhoc online meeting.
/// Creates a new online meeting.
/// Permissions required : OnlineMeetings.ReadWrite.All.
/// </summary>
/// <param name="tenantId">The tenant identifier.</param>
/// <param name="organizerId">The meeting organizer identifier.</param>
/// <param name="scenarioId">The scenario identifier - needed in case of debugging for correlating client side request with server side logs.</param>
/// <returns> The onlinemeeting. </returns>
[Obsolete("This way of creating meeting is obsolete. Check CreateUserMeetingRequestAsync for creating meetings.")]
public async Task<Microsoft.Graph.OnlineMeeting> CreateOnlineMeetingAsync(string tenantId, string organizerId, Guid scenarioId)
{
var statelessClient = new CallsGraphServiceClient(
Expand All @@ -71,7 +76,6 @@ public OnlineMeeting(IRequestAuthenticationProvider requestAuthenticationProvide

var onlineMeeting = new Microsoft.Graph.OnlineMeeting()
{
MeetingType = MeetingType.MeetNow,
Participants = new MeetingParticipants()
{
Organizer = new MeetingParticipantInfo()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<Import Project="$(MSBuildThisFileDirectory)..\..\..\Graph.props" />

<ItemGroup>
<PackageReference Include="Microsoft.Graph.Communications.Client" Version="1.1.0-prerelease.1511" />
<PackageReference Include="Microsoft.Graph.Communications.Core.Calls" Version="1.1.0-prerelease.1511" />
<PackageReference Include="Microsoft.Graph.Communications.Client" Version="1.1.0-prerelease.1855" />
<PackageReference Include="Microsoft.Graph.Communications.Core.Calls" Version="1.1.0-prerelease.1855" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
// <copyright file="OnlineMeetingMeRequest.cs" company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
// </copyright>

// THIS CODE HAS NOT BEEN TESTED RIGOROUSLY.USING THIS CODE IN PRODUCTION ENVIRONMENT IS STRICTLY NOT RECOMMENDED.
// THIS SAMPLE IS PURELY FOR DEMONSTRATION PURPOSES ONLY.
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND.
//
#pragma warning disable SA1100 // Do not prefix calls with base
#pragma warning disable SA1402 // File may contain only single type.
#pragma warning disable SA1121 // Use built-int type alias.
#pragma warning disable SA1649 // Filename should match first type.

namespace Microsoft.Graph
{
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

/// <summary>
/// IUserRequestBuilder with OnlineMeetings request collection property.
/// </summary>
public interface IUserRequestBuilderEx : IUserRequestBuilder
{
/// <summary>
/// Gets.
/// </summary>
IUserOnlineMeetingsCollectionRequestBuilder OnlineMeetings
{
get;
}
}

/// <summary>
/// UserRequestBuilderEx with support for creating onlinemeetings request collection.
/// </summary>
public class UserRequestBuilderEx : UserRequestBuilder, IUserRequestBuilderEx
{
/// <summary>
/// Initializes a new instance of the <see cref="UserRequestBuilderEx"/> class.
/// </summary>
/// <param name="requestUrl">The URL for the built request.</param>
/// <param name="client">The Microsoft.Graph.IBaseClient for handling requests.</param>
public UserRequestBuilderEx(String requestUrl, IBaseClient client)
: base(requestUrl, client)
{
}

/// <summary>
/// Gets.
/// </summary>
public IUserOnlineMeetingsCollectionRequestBuilder OnlineMeetings => new UserOnlineMeetingsCollectionRequestBuilder(this.AppendSegmentToRequestUrl("onlinemeetings"), base.Client);
}

/// <summary>
/// CallsGraphServiceClientEx adding suport for me with onlinemeetings request collection.
/// </summary>
public class CallsGraphServiceClientEx : CallsGraphServiceClient
{
/// <summary>
/// Initializes a new instance of the <see cref="CallsGraphServiceClientEx"/> class.
/// </summary>
/// <param name="baseUrl">a.</param>
/// <param name="authenticationProvider">b.</param>
/// <param name="httpProvider">c.</param>
public CallsGraphServiceClientEx(string baseUrl, IAuthenticationProvider authenticationProvider, IHttpProvider httpProvider = null)
: base(baseUrl, authenticationProvider, httpProvider)
{
}

/// <summary>
/// Gets.
/// </summary>
public new IUserRequestBuilderEx Me => new UserRequestBuilderEx(base.BaseUrl + "/me", this);
}
}

#pragma warning restore SA1100 // Do not prefix calls with base
#pragma warning restore SA1402 // File may contain only single type.
#pragma warning restore SA1121 // Use built-int type alias.
#pragma warning restore SA1649 // Filename should match first type.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
// Licensed under the MIT license.
// </copyright>

// THIS CODE HAS NOT BEEN TESTED RIGOROUSLY.USING THIS CODE IN PRODUCTION ENVIRONMENT IS STRICTLY NOT RECOMMENDED.
// THIS SAMPLE IS PURELY FOR DEMONSTRATION PURPOSES ONLY.
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND.
namespace Sample.OnlineMeeting
{
using System;
Expand All @@ -15,12 +18,17 @@ namespace Sample.OnlineMeeting
/// </summary>
public class Program
{
// Common settings.
private static string appSecret = "__placeholder__";
private static string appId = "__placeholder__";
private static string tenantId = "__placeholder__";

// Needed for app token meetings.
private static string vtcId = "__placeholder__";
private static string tenantId = "__placeholder__";
private static string organizerID = "__placeholder__";

// Needed for user token meetings.
private static string userName = "__placeholder__";
private static string password = "__placeholder__";

private static Uri graphUri = new Uri("https://graph.microsoft.com/beta/");

Expand All @@ -34,13 +42,13 @@ public class Program
{
var name = typeof(Program).Assembly.GetName().Name;
var logger = new GraphLogger(name);
var onlineMeeting = new OnlineMeeting(
var onlineMeeting = new AppOnlineMeeting(
new AuthenticationProvider(name, appId, appSecret, logger),
graphUri);

var meetingDetails = await onlineMeeting.GetOnlineMeetingByVtcIdAsync(tenantId, videoTeleconferenceId, default(Guid)).ConfigureAwait(false);

Console.WriteLine(meetingDetails.Id);
Console.WriteLine(meetingDetails.VideoTeleconferenceId);
Console.WriteLine(meetingDetails.ChatInfo.ThreadId);

return meetingDetails;
Expand All @@ -52,11 +60,12 @@ public class Program
/// <param name="tenantId">The tenant identifier.</param>
/// <param name="organizerId">The organizer identifier.</param>
/// <returns> The newly created onlinemeeting. </returns>
[Obsolete("This way of creating meeting is obsolete. Check CreateUserMeetingRequestAsync for creating meetings.")]
public static async Task<Microsoft.Graph.OnlineMeeting> CreateOnlineMeetingAsync(string tenantId, string organizerId)
{
var name = typeof(Program).Assembly.GetName().Name;
var logger = new GraphLogger(name);
var onlineMeeting = new OnlineMeeting(
var onlineMeeting = new AppOnlineMeeting(
new AuthenticationProvider(name, appId, appSecret, logger),
graphUri);

Expand All @@ -68,6 +77,28 @@ public class Program
return meetingDetails;
}

/// <summary>
/// Creates the online meeting asynchronous.
/// </summary>
/// <param name="tenantId">The tenant identifier.</param>
/// <returns> The newly created onlinemeeting. </returns>
public static async Task<Microsoft.Graph.OnlineMeeting> CreateUserOnlineMeetingAsync(string tenantId)
{
var name = typeof(Program).Assembly.GetName().Name;
var logger = new GraphLogger(name);

var onlineMeeting = new UserOnlineMeeting(
new UserPasswordAuthenticationProvider(name, appId, appSecret, userName, password, logger),
graphUri);

var meetingDetails = await onlineMeeting.CreateUserMeetingRequestAsync(tenantId, default(Guid)).ConfigureAwait(false);

Console.WriteLine(meetingDetails.Id);
Console.WriteLine(meetingDetails.ChatInfo.ThreadId);

return meetingDetails;
}

/// <summary>
/// The Main entry point.
/// </summary>
Expand All @@ -80,7 +111,13 @@ public static void Main(string[] args)
{
var meetingDetails = await GetOnlineMeetingByVtcIdAsync(tenantId, vtcId).ConfigureAwait(false);

var createdMeetingDetails = await CreateOnlineMeetingAsync(tenantId, organizerID).ConfigureAwait(false);
/*
* THIS WAY OF CREATING MEETING IS OBSOLETE. CHECK CreateUserOnlineMeetingAsync FOR CREATING MEETINGS.
*
* var createdMeetingDetails = await CreateOnlineMeetingAsync(tenantId, organizerID).ConfigureAwait(false);
*/

var userTokenMeeting = await CreateUserOnlineMeetingAsync(tenantId).ConfigureAwait(false);
}
catch (Exception ex)
{
Expand Down
30 changes: 19 additions & 11 deletions Samples/BetaSamples/StatelessSamples/OnlineMeetingSamples/README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,36 @@
# Introduction
# THE SAMPLE PROVIDED IS PURELY FOR DEMONSTRATION PURPOSES ONLY.THIS CODE AND INFORMATION IS PROVIDED "AS IS"
# WITHOUT WARRANTY OF ANY KIND.

# Introduction

## About
The online meeting stateless sample demonstrates how one can consume Microsoft.Skype.Graph.CoreSDK in thier bot application to
1. Get an online meeting based on meetingid (current support is only for [vtcid](https://docs.microsoft.com/en-us/microsoftteams/cloud-video-interop)).
1. Create a adhoc online meeting on behalf of an organizer in your tenant.
The online meeting stateless sample demonstrates how one can consume Microsoft.Graph.Communications.Client in bot application to
1. Get an online meeting based on on [vtcid](https://docs.microsoft.com/en-us/microsoftteams/cloud-video-interop)).
2. Create a online meeting on behalf a user (delegated auth) in your tenant.

## Getting Started
### Prerequisites
1. [Permissions](https://developer.microsoft.com/en-us/graph/docs/concepts/permissions_reference#online-meetings-permissions) - The following persmissions are needed by the bot application to successfully authenticate against the online meeting service.
* OnlineMeetings.Read.All OR OnlineMeetings.ReadWrite.All for getting meeting details
* OnlineMeetings.ReadWrite.All for creating a meeting.
* OnlineMeetings.ReadWrite for creating a meeting.

1. Tools.
* [Visual Studio 2017](https://visualstudio.microsoft.com/downloads/)
* [Visual Studio 2017 or above](https://visualstudio.microsoft.com/downloads/)


## Build and Test

1. Open OnlineMeetingsSample.sln in Visual Studio 2017 and update the values of the following in `program.cs`
1. Open OnlineMeetingsSample.sln in Visual Studio and update the values of the following in `program.cs`
* `appId, appSecret` : AppId, Appsecret of your bot application
* `tenantId` : Tenant against which to fetch/create the online meeting.
* `meetingId (Only needed for GET)` : The VTC conference id.
* `organizerId (Only needed for Create)` : oid of the user on behalf of whom the adhoc meeting is to be created.
* Note - The organizerId should belong to the same tenant as specified by teanantid
* `vtcid (Only needed for GET)` : The VTC conference id.
* `userName, password (Only needed for Create)` : Username, Password of the user.
* Note - The user should belong to the same tenant as specified by teanantId

2. Build, Run the application.



# References
Please refer following links on various ways to get access tokens. Please use the appropriate mechanism which meets with the requirements of your organization.
* https://docs.microsoft.com/en-us/graph/auth-v2-user
* https://github.com/microsoftgraph/msgraph-sdk-dotnet-auth
Loading

0 comments on commit cfb4964

Please sign in to comment.