Skip to content

Commit cda737f

Browse files
committed
Merged dev into master
2 parents 0d30dab + 5b9ed5b commit cda737f

File tree

4,114 files changed

+48859
-2565
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

4,114 files changed

+48859
-2565
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
*.user
44
*.userosscache
55
*.sln.ide
6+
*.snk
67
TestResults/*
78
.vs/*
89

Microsoft.Graph.sln

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,27 @@
1-
21
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 14
4-
VisualStudioVersion = 14.0.24720.0
2+
# Visual Studio 15
3+
VisualStudioVersion = 15.0.26228.9
54
MinimumVisualStudioVersion = 10.0.40219.1
65
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{5E0B65FC-67B7-41F8-87BF-96D6A342C438}"
76
EndProject
87
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{6496B661-8321-4D07-ACC2-B6602649293C}"
98
EndProject
10-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Graph", "src\Microsoft.Graph\Microsoft.Graph.csproj", "{660FA73B-987D-4085-A230-1B04F7EAEFBC}"
9+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Graph", "src\Microsoft.Graph\Microsoft.Graph.csproj", "{660FA73B-987D-4085-A230-1B04F7EAEFBC}"
1110
EndProject
1211
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Graph.Test", "tests\Microsoft.Graph.Test\Microsoft.Graph.Test.csproj", "{025D498D-0FF5-4BE2-89ED-3D90D407DFFE}"
12+
ProjectSection(ProjectDependencies) = postProject
13+
{660FA73B-987D-4085-A230-1B04F7EAEFBC} = {660FA73B-987D-4085-A230-1B04F7EAEFBC}
14+
{9F04608C-D845-4445-83B1-E6D4EEE38CBC} = {9F04608C-D845-4445-83B1-E6D4EEE38CBC}
15+
EndProjectSection
1316
EndProject
14-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Graph.Core", "src\Microsoft.Graph.Core\Microsoft.Graph.Core.csproj", "{9F04608C-D845-4445-83B1-E6D4EEE38CBC}"
17+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Graph.Core", "src\Microsoft.Graph.Core\Microsoft.Graph.Core.csproj", "{9F04608C-D845-4445-83B1-E6D4EEE38CBC}"
1518
EndProject
1619
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Graph.Core.Test", "tests\Microsoft.Graph.Core.Test\Microsoft.Graph.Core.Test.csproj", "{5169EDAD-1E05-42A5-A241-D6FA78A02C5C}"
1720
EndProject
21+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Graph.DotnetCore.Core.Test", "tests\Microsoft.Graph.DotnetCore.Core.Test\Microsoft.Graph.DotnetCore.Core.Test.csproj", "{A337BD4B-5C76-4BC5-8EC2-2EE7B834D030}"
22+
EndProject
23+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Graph.DotnetCore.Test", "tests\Microsoft.Graph.DotnetCore.Test\Microsoft.Graph.DotnetCore.Test.csproj", "{A46FC884-EDDC-4617-9B52-37017A90241D}"
24+
EndProject
1825
Global
1926
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2027
Debug|Any CPU = Debug|Any CPU
@@ -83,6 +90,38 @@ Global
8390
{5169EDAD-1E05-42A5-A241-D6FA78A02C5C}.Release|ARM.ActiveCfg = Release|Any CPU
8491
{5169EDAD-1E05-42A5-A241-D6FA78A02C5C}.Release|x64.ActiveCfg = Release|Any CPU
8592
{5169EDAD-1E05-42A5-A241-D6FA78A02C5C}.Release|x86.ActiveCfg = Release|Any CPU
93+
{A337BD4B-5C76-4BC5-8EC2-2EE7B834D030}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
94+
{A337BD4B-5C76-4BC5-8EC2-2EE7B834D030}.Debug|Any CPU.Build.0 = Debug|Any CPU
95+
{A337BD4B-5C76-4BC5-8EC2-2EE7B834D030}.Debug|ARM.ActiveCfg = Debug|Any CPU
96+
{A337BD4B-5C76-4BC5-8EC2-2EE7B834D030}.Debug|ARM.Build.0 = Debug|Any CPU
97+
{A337BD4B-5C76-4BC5-8EC2-2EE7B834D030}.Debug|x64.ActiveCfg = Debug|Any CPU
98+
{A337BD4B-5C76-4BC5-8EC2-2EE7B834D030}.Debug|x64.Build.0 = Debug|Any CPU
99+
{A337BD4B-5C76-4BC5-8EC2-2EE7B834D030}.Debug|x86.ActiveCfg = Debug|Any CPU
100+
{A337BD4B-5C76-4BC5-8EC2-2EE7B834D030}.Debug|x86.Build.0 = Debug|Any CPU
101+
{A337BD4B-5C76-4BC5-8EC2-2EE7B834D030}.Release|Any CPU.ActiveCfg = Release|Any CPU
102+
{A337BD4B-5C76-4BC5-8EC2-2EE7B834D030}.Release|Any CPU.Build.0 = Release|Any CPU
103+
{A337BD4B-5C76-4BC5-8EC2-2EE7B834D030}.Release|ARM.ActiveCfg = Release|Any CPU
104+
{A337BD4B-5C76-4BC5-8EC2-2EE7B834D030}.Release|ARM.Build.0 = Release|Any CPU
105+
{A337BD4B-5C76-4BC5-8EC2-2EE7B834D030}.Release|x64.ActiveCfg = Release|Any CPU
106+
{A337BD4B-5C76-4BC5-8EC2-2EE7B834D030}.Release|x64.Build.0 = Release|Any CPU
107+
{A337BD4B-5C76-4BC5-8EC2-2EE7B834D030}.Release|x86.ActiveCfg = Release|Any CPU
108+
{A337BD4B-5C76-4BC5-8EC2-2EE7B834D030}.Release|x86.Build.0 = Release|Any CPU
109+
{A46FC884-EDDC-4617-9B52-37017A90241D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
110+
{A46FC884-EDDC-4617-9B52-37017A90241D}.Debug|Any CPU.Build.0 = Debug|Any CPU
111+
{A46FC884-EDDC-4617-9B52-37017A90241D}.Debug|ARM.ActiveCfg = Debug|Any CPU
112+
{A46FC884-EDDC-4617-9B52-37017A90241D}.Debug|ARM.Build.0 = Debug|Any CPU
113+
{A46FC884-EDDC-4617-9B52-37017A90241D}.Debug|x64.ActiveCfg = Debug|Any CPU
114+
{A46FC884-EDDC-4617-9B52-37017A90241D}.Debug|x64.Build.0 = Debug|Any CPU
115+
{A46FC884-EDDC-4617-9B52-37017A90241D}.Debug|x86.ActiveCfg = Debug|Any CPU
116+
{A46FC884-EDDC-4617-9B52-37017A90241D}.Debug|x86.Build.0 = Debug|Any CPU
117+
{A46FC884-EDDC-4617-9B52-37017A90241D}.Release|Any CPU.ActiveCfg = Release|Any CPU
118+
{A46FC884-EDDC-4617-9B52-37017A90241D}.Release|Any CPU.Build.0 = Release|Any CPU
119+
{A46FC884-EDDC-4617-9B52-37017A90241D}.Release|ARM.ActiveCfg = Release|Any CPU
120+
{A46FC884-EDDC-4617-9B52-37017A90241D}.Release|ARM.Build.0 = Release|Any CPU
121+
{A46FC884-EDDC-4617-9B52-37017A90241D}.Release|x64.ActiveCfg = Release|Any CPU
122+
{A46FC884-EDDC-4617-9B52-37017A90241D}.Release|x64.Build.0 = Release|Any CPU
123+
{A46FC884-EDDC-4617-9B52-37017A90241D}.Release|x86.ActiveCfg = Release|Any CPU
124+
{A46FC884-EDDC-4617-9B52-37017A90241D}.Release|x86.Build.0 = Release|Any CPU
86125
EndGlobalSection
87126
GlobalSection(SolutionProperties) = preSolution
88127
HideSolutionNode = FALSE

README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,7 @@
66
Integrate the [Microsoft Graph API](https://graph.microsoft.io) into your .NET
77
project!
88

9-
The Microsoft Graph .NET Client Library is built as a Portable Class Library targeting profile 111.
10-
This targets the following frameworks:
11-
12-
* .NET 4.5
13-
* .NET for Windows Store apps
14-
* Windows Phone 8.1 and higher
9+
The Microsoft Graph .NET Client Library targets .NetStandard 1.1 and .Net Framework 4.5.
1510

1611
## Installation via NuGet
1712

@@ -103,6 +98,8 @@ The following sample applications are also available:
10398

10499
Install NewtonSoft.Json first if you want to use a version greater than NewtonSoft.Json 6.0.1. For example, you'll need to install NewtonSoft.Json 9.0.1 first if you want to use this to library while targeting .Net Core with standard1.0.
105100

101+
Install System.Runtime.InteropServices.RuntimeInformation before you install Microsoft.Graph >=1.3 if you are having an issue updating the package for a Xamarin solution. You may need to updated references to Microsoft.NETCore.UniversalWindowsPlatform to >=5.2.2 as well.
102+
106103
## Issues
107104

108105
To view or log issues, see [issues](https://github.com/microsoftgraph/msgraph-sdk-dotnet/issues).

src/Microsoft.Graph.Core/Exceptions/ServiceException.cs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace Microsoft.Graph
99
public class ServiceException : Exception
1010
{
1111
public ServiceException(Error error, Exception innerException = null)
12-
: base(null, innerException)
12+
: base(error?.ToString(), innerException)
1313
{
1414
this.Error = error;
1515
}
@@ -42,15 +42,5 @@ public bool IsMatch(string errorCode)
4242

4343
return false;
4444
}
45-
46-
public override string ToString()
47-
{
48-
if (this.Error != null)
49-
{
50-
return this.Error.ToString();
51-
}
52-
53-
return null;
54-
}
5545
}
5646
}
Lines changed: 47 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -1,115 +1,53 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
1+
<Project Sdk="Microsoft.NET.Sdk">
42
<PropertyGroup>
5-
<MinimumVisualStudioVersion>10.0</MinimumVisualStudioVersion>
6-
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
7-
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
8-
<ProjectGuid>{9F04608C-D845-4445-83B1-E6D4EEE38CBC}</ProjectGuid>
9-
<OutputType>Library</OutputType>
10-
<AppDesignerFolder>Properties</AppDesignerFolder>
11-
<RootNamespace>Microsoft.Graph</RootNamespace>
3+
<Description>Microsoft Graph Core Client Library implements core functionality used by Microsoft Graph Client Libraries.</Description>
4+
<Copyright>Copyright (c) Microsoft Corporation</Copyright>
5+
<AssemblyTitle>Microsoft Graph Core Client Library</AssemblyTitle>
6+
<VersionPrefix>1.4.0</VersionPrefix>
7+
<Authors>Microsoft</Authors>
8+
<TargetFrameworks>netstandard1.1;net45</TargetFrameworks>
129
<AssemblyName>Microsoft.Graph.Core</AssemblyName>
13-
<DefaultLanguage>en-US</DefaultLanguage>
14-
<FileAlignment>512</FileAlignment>
15-
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
16-
<TargetFrameworkProfile>Profile111</TargetFrameworkProfile>
17-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
10+
<PackageId>Microsoft.Graph.Core</PackageId>
11+
<PackageTags>Microsoft Office365;Graph;GraphServiceClient;Outlook;OneDrive;AzureAD;GraphAPI;Productivity;SharePoint;SDK</PackageTags>
12+
<PackageReleaseNotes>
13+
May 2017 Release Summary (version 1.4.0)
14+
15+
New features
16+
17+
* Added support for .NetStandard 1.1
18+
19+
Updates
20+
21+
* Updated dependency on Newtonsoft.Json to 10.0.2.
22+
* Removed the Exception ToString override
23+
</PackageReleaseNotes>
24+
<PackageProjectUrl>https://graph.microsoft.io</PackageProjectUrl>
25+
<PackageLicenseUrl>http://aka.ms/devservicesagreement</PackageLicenseUrl>
26+
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
27+
<NetStandardImplicitPackageVersion Condition=" '$(TargetFramework)' == 'netstandard1.1' ">1.6.0</NetStandardImplicitPackageVersion>
28+
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
29+
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
30+
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
31+
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
32+
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
33+
<GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute>
34+
<GenerateNeutralResourcesLanguageAttribute>false</GenerateNeutralResourcesLanguageAttribute>
35+
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
36+
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
37+
<SignAssembly>True</SignAssembly>
38+
<DelaySign>True</DelaySign>
39+
<AssemblyOriginatorKeyFile>35MSSharedLib1024.snk</AssemblyOriginatorKeyFile>
1840
</PropertyGroup>
19-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
20-
<DebugSymbols>true</DebugSymbols>
21-
<DebugType>full</DebugType>
22-
<Optimize>false</Optimize>
23-
<OutputPath>bin\Debug\</OutputPath>
24-
<DefineConstants>DEBUG;TRACE</DefineConstants>
25-
<ErrorReport>prompt</ErrorReport>
26-
<WarningLevel>4</WarningLevel>
27-
</PropertyGroup>
28-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
29-
<DebugType>pdbonly</DebugType>
30-
<Optimize>true</Optimize>
31-
<OutputPath>bin\Release\</OutputPath>
32-
<DefineConstants>TRACE</DefineConstants>
33-
<ErrorReport>prompt</ErrorReport>
34-
<WarningLevel>4</WarningLevel>
35-
</PropertyGroup>
36-
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
37-
<SignAssembly>true</SignAssembly>
38-
<DelaySign>true</DelaySign>
39-
<AssemblyOriginatorKeyFile>..\..\build\35MSSharedLib1024.snk</AssemblyOriginatorKeyFile>
40-
</PropertyGroup>
41-
<ItemGroup>
42-
<Compile Include="Authentication\DelegateAuthenticationProvider.cs" />
43-
<Compile Include="Authentication\IAuthenticationProvider.cs" />
44-
<Compile Include="CoreConstants.cs" />
45-
<Compile Include="Exceptions\Error.cs" />
46-
<Compile Include="Exceptions\ErrorConstants.cs" />
47-
<Compile Include="Exceptions\ErrorResponse.cs" />
48-
<Compile Include="Exceptions\ServiceException.cs" />
49-
<Compile Include="Helpers\ExtractSelectHelper.cs" />
50-
<Compile Include="Helpers\StringHelper.cs" />
51-
<Compile Include="Helpers\UrlHelper.cs" />
52-
<Compile Include="Models\AsyncOperationStatus.cs" />
53-
<Compile Include="Models\CollectionPage.cs" />
54-
<Compile Include="Models\Date.cs" />
55-
<Compile Include="Models\ICollectionPage.cs" />
56-
<Compile Include="Models\ReferenceRequestBody.cs" />
57-
<Compile Include="Properties\AssemblyInfo.cs" />
58-
<Compile Include="Requests\AsyncMonitor.cs" />
59-
<Compile Include="Requests\BaseClient.cs" />
60-
<Compile Include="Requests\BaseActionMethodRequestBuilder.cs" />
61-
<Compile Include="Requests\BaseRequest.cs" />
62-
<Compile Include="Requests\BaseFunctionMethodRequestBuilder.cs" />
63-
<Compile Include="Requests\BaseRequestBuilder.cs" />
64-
<Compile Include="Requests\HttpProvider.cs" />
65-
<Compile Include="Requests\IAsyncMonitor.cs" />
66-
<Compile Include="Requests\IBaseClient.cs" />
67-
<Compile Include="Requests\IBaseRequest.cs" />
68-
<Compile Include="Requests\IBaseRequestBuilder.cs" />
69-
<Compile Include="Requests\IHttpProvider.cs" />
70-
<Compile Include="Requests\Options\HeaderOption.cs" />
71-
<Compile Include="Requests\Options\Option.cs" />
72-
<Compile Include="Requests\Options\QueryOption.cs" />
73-
<Compile Include="Serialization\DateConverter.cs" />
74-
<Compile Include="Serialization\DerivedTypeConverter.cs" />
75-
<Compile Include="Serialization\EnumConverter.cs" />
76-
<Compile Include="Serialization\InterfaceConverter.cs" />
77-
<Compile Include="Serialization\ISerializer.cs" />
78-
<Compile Include="Serialization\Serializer.cs" />
79-
</ItemGroup>
80-
<ItemGroup>
81-
<None Include="Microsoft.Graph.Core.nuspec" />
82-
<None Include="packages.config" />
41+
42+
<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
43+
<Reference Include="System.Net.Http" />
44+
<Reference Include="System" />
45+
<Reference Include="Microsoft.CSharp" />
46+
<PackageReference Include="Newtonsoft.Json" Version="10.0.2" />
8347
</ItemGroup>
84-
<ItemGroup>
85-
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
86-
<HintPath>..\..\packages\Newtonsoft.Json.9.0.1\lib\portable-net45+wp80+win8+wpa81\Newtonsoft.Json.dll</HintPath>
87-
<Private>True</Private>
88-
</Reference>
48+
49+
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.1' ">
50+
<PackageReference Include="Newtonsoft.Json" Version="10.0.2" />
8951
</ItemGroup>
90-
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
91-
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
92-
Other similar extension points exist, see Microsoft.Common.targets.
93-
<Target Name="BeforeBuild">
94-
</Target>-->
95-
<UsingTask TaskName="DownloadFile" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
96-
<ParameterGroup>
97-
<Url ParameterType="System.String" Required="true" />
98-
<FileName ParameterType="System.String" Required="true" />
99-
</ParameterGroup>
100-
<Task>
101-
<Reference Include="System" />
102-
<Code Type="Fragment" Language="cs">
103-
<![CDATA[
104-
new System.Net.WebClient().DownloadFile(Url, FileName);
105-
]]>
106-
</Code>
107-
</Task>
108-
</UsingTask>
109-
<Target Name="AfterBuild" Condition="'$(Configuration)' == 'Release'">
110-
<!-- Download nuget.exe if we need it -->
111-
<DownloadFile Condition="!Exists('$(OutputPath)\nuget.exe')" FileName="$(OutputPath)\nuget.exe" Url="https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" />
112-
<!-- Pack up a nuget package -->
113-
<Exec Command="$(OutputPath)\nuget pack $(ProjectFileName) -Properties Configuration=Release -OutputDirectory $(OutputPath)" />
114-
</Target>
52+
11553
</Project>
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// ------------------------------------------------------------------------------
2+
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
3+
// ------------------------------------------------------------------------------
4+
5+
namespace Microsoft.Graph
6+
{
7+
using Newtonsoft.Json;
8+
using System;
9+
using System.Xml;
10+
11+
/// <summary>
12+
/// Represents an edm.duration value.
13+
/// </summary>
14+
[JsonConverter(typeof(DurationConverter))]
15+
public class Duration
16+
{
17+
internal TimeSpan TimeSpan { get; set; }
18+
19+
/// <summary>
20+
/// Create a Duration object from a TimeSpan.
21+
/// </summary>
22+
/// <param name="timeSpan"></param>
23+
public Duration(TimeSpan timeSpan)
24+
{
25+
this.TimeSpan = timeSpan;
26+
}
27+
28+
/// <summary>
29+
/// Create a Duration object from an ISO8601 duration.
30+
/// </summary>
31+
/// <param name="duration">An ISO8601 duration. http://en.wikipedia.org/wiki/ISO_8601#Durations </param>
32+
public Duration(string duration)
33+
{
34+
// Convert an ISO8601 duration to a TimeSpan.
35+
this.TimeSpan = XmlConvert.ToTimeSpan(duration);
36+
}
37+
38+
/// <summary>
39+
/// Convert the stored TimeSpan into an ISO8601 duration.
40+
/// </summary>
41+
/// <returns>An ISO8601 duration. For example, PT1M is "period time of 1 minute"</returns>
42+
public override string ToString()
43+
{
44+
return XmlConvert.ToString(this.TimeSpan);
45+
}
46+
}
47+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// ------------------------------------------------------------------------------
2+
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
3+
// ------------------------------------------------------------------------------
4+
5+
namespace Microsoft.Graph
6+
{
7+
using System;
8+
9+
using Newtonsoft.Json;
10+
11+
[JsonConverter(typeof(TimeOfDayConverter))]
12+
public class TimeOfDay
13+
{
14+
internal DateTime DateTime { get; set; }
15+
16+
internal TimeOfDay(DateTime dateTime)
17+
{
18+
this.DateTime = dateTime;
19+
}
20+
21+
public TimeOfDay(int hour, int minute, int second)
22+
: this(new DateTime(1, 1, 1, hour, minute, second))
23+
{
24+
}
25+
26+
public int Hour
27+
{
28+
get
29+
{
30+
return this.DateTime.Hour;
31+
}
32+
}
33+
34+
public int Minute
35+
{
36+
get
37+
{
38+
return this.DateTime.Minute;
39+
}
40+
}
41+
42+
public int Second
43+
{
44+
get
45+
{
46+
return this.DateTime.Second;
47+
}
48+
}
49+
50+
public override string ToString()
51+
{
52+
return this.DateTime.ToString("HH:mm:ss");
53+
}
54+
}
55+
}

0 commit comments

Comments
 (0)