Skip to content

Commit

Permalink
Update Newtonsoft reference, enable group/team creation in fluent API
Browse files Browse the repository at this point in the history
Merge commit #352 from microsoftgraph/1.13.0-preview.2

Update project Newtonsoft package reference and enable team creation on group
  • Loading branch information
MIchaelMainer authored Jan 10, 2019
2 parents 1a0e1c9 + dc8e2d2 commit 1c33ddf
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 6 deletions.
7 changes: 4 additions & 3 deletions src/Microsoft.Graph.Core/Microsoft.Graph.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
<PackageId>Microsoft.Graph.Core</PackageId>
<PackageTags>Microsoft Office365;Graph;GraphServiceClient;Outlook;OneDrive;AzureAD;GraphAPI;Productivity;SharePoint;Intune;SDK</PackageTags>
<PackageReleaseNotes>
December 2018 Release Summary (version 1.13.0)
January 2019 Release Summary (version 1.13.0-preview.2)

- Authentication handler added.
- Removed Newtonsoft.Json package reference upper bound limitation.
</PackageReleaseNotes>
<PackageProjectUrl>https://developer.microsoft.com/graph</PackageProjectUrl>
<PackageLicenseUrl>http://aka.ms/devservicesagreement</PackageLicenseUrl>
Expand All @@ -35,7 +36,7 @@ December 2018 Release Summary (version 1.13.0)
<DelaySign>false</DelaySign>
<AssemblyOriginatorKeyFile>35MSSharedLib1024.snk</AssemblyOriginatorKeyFile>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Version>1.13.0-preview</Version>
<Version>1.13.0-preview.2</Version>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netstandard1.1|AnyCPU'">
<DocumentationFile>bin\Release\netstandard1.1\Microsoft.Graph.Core.xml</DocumentationFile>
Expand All @@ -54,7 +55,7 @@ December 2018 Release Summary (version 1.13.0)
<Reference Include="System.Net.Http" />
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
<PackageReference Include="Newtonsoft.Json" Version="[6.0.1,12)" />
<PackageReference Include="Newtonsoft.Json" Version="6.0.1" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.1' ">
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
Expand Down
7 changes: 4 additions & 3 deletions src/Microsoft.Graph/Microsoft.Graph.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<PackageId>Microsoft.Graph</PackageId>
<PackageTags>Microsoft Office365;Graph;GraphServiceClient;Outlook;OneDrive;AzureAD;GraphAPI;Productivity;SharePoint;Intune;SDK</PackageTags>
<PackageReleaseNotes>
December 2018 Release Summary (version 1.13.0)
January 2019 Release Summary (version 1.13.0-preview.2)

New functionality
- Added new Teams API functionality.
Expand All @@ -25,6 +25,7 @@ Updated functionality
- Device is updated with the MemberOf relationship.
- Group is updated with the isArchived property and Team relationship.
- User is updated with the JoinedTeams relationship.
- Removed Newtonsoft.Json package reference upper bound limitation.
</PackageReleaseNotes>
<PackageProjectUrl>https://developer.microsoft.com/graph</PackageProjectUrl>
<PackageLicenseUrl>http://aka.ms/devservicesagreement</PackageLicenseUrl>
Expand All @@ -44,7 +45,7 @@ Updated functionality
<DelaySign>false</DelaySign>
<AssemblyOriginatorKeyFile>35MSSharedLib1024.snk</AssemblyOriginatorKeyFile>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Version>1.13.0-preview</Version>
<Version>1.13.0-preview.2</Version>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netstandard1.1|AnyCPU'">
<DocumentationFile>bin\Release\Microsoft.Graph.xml</DocumentationFile>
Expand All @@ -57,7 +58,7 @@ Updated functionality
<Reference Include="System" />
<Reference Include="System.Net.Http" />
<Reference Include="Microsoft.CSharp" />
<PackageReference Include="Newtonsoft.Json" Version="[6.0.1,12)" />
<PackageReference Include="Newtonsoft.Json" Version="6.0.1" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.1' ">
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
Expand Down
50 changes: 50 additions & 0 deletions src/Microsoft.Graph/Requests/Extensions/TeamRequestExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
using System.Threading;

namespace Microsoft.Graph
{
public partial interface ITeamRequest
{
/// <summary>
/// Creates the specified Team using PUT.
/// </summary>
/// <param name="teamToCreate">The Team to create.</param>
/// <returns>The created Team.</returns>
System.Threading.Tasks.Task<Team> PutAsync(Team teamToCreate);

/// <summary>
/// Creates the specified Team using PUT.
/// </summary>
/// <param name="teamToCreate">The Team to create.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
/// <returns>The created Team.</returns>
System.Threading.Tasks.Task<Team> PutAsync(Team teamToCreate, CancellationToken cancellationToken);
}

public partial class TeamRequest
{
/// <summary>
/// Creates the specified Team using PUT.
/// </summary>
/// <param name="teamToCreate">The Team to create.</param>
/// <returns>The created Team.</returns>
public System.Threading.Tasks.Task<Team> PutAsync(Team teamToCreate)
{
return this.PutAsync(teamToCreate, CancellationToken.None);
}

/// <summary>
/// Creates the specified Team using PUT.
/// </summary>
/// <param name="teamToCreate">The Team to create.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
/// <returns>The created Team.</returns>
public async System.Threading.Tasks.Task<Team> PutAsync(Team teamToCreate, CancellationToken cancellationToken)
{
this.ContentType = "application/json";
this.Method = "PUT";
var newEntity = await this.SendAsync<Team>(teamToCreate, cancellationToken).ConfigureAwait(false);
this.InitializeCollectionProperties(newEntity);
return newEntity;
}
}
}
1 change: 1 addition & 0 deletions tests/Microsoft.Graph.Test/Microsoft.Graph.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
<Compile Include="Requests\Functional\ContactTests.cs" />
<Compile Include="Requests\Functional\EventTests.cs" />
<Compile Include="Requests\Functional\GraphTestBase.cs" />
<Compile Include="Requests\Functional\GroupTests.cs" />
<Compile Include="Requests\Functional\MailTests.cs" />
<Compile Include="Requests\Functional\OneDriveTests.cs" />
<Compile Include="Requests\Functional\ErrorTests.cs" />
Expand Down
41 changes: 41 additions & 0 deletions tests/Microsoft.Graph.Test/Requests/Functional/GroupTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Collections.Generic;
using Async = System.Threading.Tasks;

namespace Microsoft.Graph.Test.Requests.Functional
{
[Ignore]
[TestClass]
public class GroupTests : GraphTestBase
{
/// <summary>
/// Create a team on a group.
/// </summary>
[TestMethod]
public async Async.Task GroupCreateTeam()
{
try
{
// Get a groups collection. We'll use the first entry to add the team. Results in a call to the service.
IGraphServiceGroupsCollectionPage groupPage = await graphClient.Groups.Request().GetAsync();

// Create a team with settings.
Team team = new Team()
{
MemberSettings = new TeamMemberSettings()
{
AllowCreateUpdateChannels = true
}
};

// Add a team to the group. Results in a call to the service.
await graphClient.Groups[groupPage[8].Id].Team.Request().PutAsync(team);
}
catch (ServiceException e)
{
Assert.Fail(e.Error.ToString());
}
}
}
}

0 comments on commit 1c33ddf

Please sign in to comment.