Skip to content

Commit ff6c752

Browse files
July update 2018 - Add Activity API PUT functionality (#288)
* Fixed typo and broken link (#275) * Fixes issue #274 * Fixed link to the Graph authorization docs. Also fixed some code formatting issues. * Update MSAL to 1.1.2-preview (#235) * removing Windows.Forms referencee * Updated System.Net.Http from 4.3.1 to 4.3.3 (#279) * Adding PUT support and functional tests for Activity Feed Service API (#281) (#284) * Moving files under Requests/Extensions * Fixing namespace in tests * Turning off signing in repo, adding public key file (#283) * Make public key accessible for automation
1 parent 56a3147 commit ff6c752

16 files changed

+434
-66
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*.user
44
*.userosscache
55
*.sln.ide
6-
*.snk
6+
#*.snk
77
TestResults/*
88
.vs/*
99

docs/overview.md

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,20 @@ To begin making requests with the library, you will need to initialize a **Graph
2626

2727
## IAuthenticationProvider
2828

29-
The authentication provider is responsible for authenticating requests before sending them to the service. The Microsoft Graph .NET Client Library doesn't implement any authentication by default. Instead, you will need to retrieve access tokens for the service via the authentication library of your choice or by coding against one of the authentication endpoints directly. Please [read here](https://graph.microsoft.io/en-us/docs/authorization/app_authorization) for more details about authenticating the Microsoft Graph service.
29+
The authentication provider is responsible for authenticating requests before sending them to the service. The Microsoft Graph .NET Client Library doesn't implement any authentication by default. Instead, you will need to retrieve access tokens for the service via the authentication library of your choice or by coding against one of the authentication endpoints directly. Please [read here](https://developer.microsoft.com/en-us/graph/docs/concepts/auth_overview) for more details about authenticating the Microsoft Graph service.
3030

3131
### DelegateAuthenticationProvider
3232

3333
The `DelegateAuthenticationProvider` is an implementation of `IAuthenticationProvider` that accepts a delegate to call during `AuthenticateRequestAsync`. This is the simplest way to append a retrieved access token to a request message:
3434

35-
```csharp
36-
var graphserviceClient = new GraphServiceClient(
37-
new DelegateAuthenticationProvider(
38-
(requestMessage) =>
39-
{
40-
requestMessage.Headers.Authorization = new AuthenticationHeaderValue("bearer", accessToken);
35+
``` csharp
36+
var graphServiceClient = new GraphServiceClient(new DelegateAuthenticationProvider((requestMessage) => {
37+
requestMessage
38+
.Headers
39+
.Authorization = new AuthenticationHeaderValue("bearer", accessToken);
4140

42-
return Task.FromResult(0);
43-
}));
41+
return Task.FromResult(0);
42+
}));
4443
```
4544

4645

@@ -77,21 +76,21 @@ After you build the request you call the `Request` method on the request builder
7776

7877
For /me/calendar you call:
7978

80-
```csharp
79+
``` csharp
8180
var calendarRequest = graphServiceClient
82-
.Me
83-
.Calendar
84-
.Request();
81+
.Me
82+
.Calendar
83+
.Request();
8584
```
8685

8786
All request builders have a `Request` method that can generate a request object. Request objects may have different methods on them depending on the type of request. To get /me/calendar you call:
8887

89-
```csharp
88+
``` csharp
9089
var calendar = await graphServiceClient
91-
.Me
92-
.Calendar
93-
.Request()
94-
.GetAsync();
90+
.Me
91+
.Calendar
92+
.Request()
93+
.GetAsync();
9594
```
9695

9796
Any errors while building or sending a request will bubble up as a `ServiceException`. See [errors](/docs/errors.md) for more information on errors.
@@ -100,12 +99,12 @@ Any errors while building or sending a request will bubble up as a `ServiceExcep
10099

101100
If you only want to retrieve certain properties of a resource you can select them. Here's how to get only the ID of the me object:
102101

103-
```csharp
102+
``` csharp
104103
var user = await graphServiceClient
105-
.Me
106-
.Request()
107-
.Select("id")
108-
.GetAsync();
104+
.Me
105+
.Request()
106+
.Select("id")
107+
.GetAsync();
109108
```
110109

111110
All properties other than `Id` will be null on the returned user object.
@@ -116,7 +115,7 @@ Expand, Skip, Top, OrderBy, and Filter are also supported via the client library
116115

117116
If you need to include more specific behavior during a request that is not supported by the library, you can create a custom queryOptions List that you can add when calling ```Request```:
118117

119-
```chsarp
118+
``` chsarp
120119
List<QueryOption> options = new List<QueryOption>
121120
{
122121
new QueryOption("$search", "lunch")
@@ -134,7 +133,7 @@ Please see [collections](/docs/collections.md) for details on collections and pa
134133

135134
Sometimes, the functionality that you want to use isn't a part of the .NET client library. In this case, you can still use the client library to make your life easier. The client library can authenticate your requests and provide you the serializers. Here's an example of using the client library to create a OneNote page and deserialize the response object.
136135

137-
```csharp
136+
``` csharp
138137

139138
public async Task OneNoteAddPageHtml()
140139
{
160 Bytes
Binary file not shown.

src/Microsoft.Graph.Core/Microsoft.Graph.Core.csproj

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,21 @@
33
<Description>Microsoft Graph Core Client Library implements core functionality used by Microsoft Graph Client Libraries.</Description>
44
<Copyright>Copyright (c) Microsoft Corporation</Copyright>
55
<AssemblyTitle>Microsoft Graph Core Client Library</AssemblyTitle>
6-
<VersionPrefix>1.9.0</VersionPrefix>
7-
<FileVersion>1.9.0</FileVersion>
8-
<AssemblyVersion>1.9.0</AssemblyVersion>
6+
<VersionPrefix>1.10.0</VersionPrefix>
7+
<FileVersion>1.10.0</FileVersion>
8+
<AssemblyVersion>1.10.0</AssemblyVersion>
99
<Authors>Microsoft</Authors>
1010
<TargetFrameworks>netstandard1.1;net45</TargetFrameworks>
1111
<PreserveCompilationContext>false</PreserveCompilationContext>
1212
<AssemblyName>Microsoft.Graph.Core</AssemblyName>
1313
<PackageId>Microsoft.Graph.Core</PackageId>
1414
<PackageTags>Microsoft Office365;Graph;GraphServiceClient;Outlook;OneDrive;AzureAD;GraphAPI;Productivity;SharePoint;Intune;SDK</PackageTags>
1515
<PackageReleaseNotes>
16-
May 2018 Release Summary (version 1.9.0)
16+
July 2018 Release Summary (version 1.10.0)
1717

1818
New features
19-
- Added more comments.
20-
- Added response headers and status to all calls that return a non-stream object.
21-
- Added SerializeObject method to MockSerializer.
19+
- Added the ability to append an arbitrary URL segment to a request. This will support the creation of custom requests.
20+
- Set signing properties in .csproj to be 'false' by default.
2221
</PackageReleaseNotes>
2322
<PackageProjectUrl>https://developer.microsoft.com/graph</PackageProjectUrl>
2423
<PackageLicenseUrl>http://aka.ms/devservicesagreement</PackageLicenseUrl>
@@ -34,11 +33,11 @@ New features
3433
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
3534
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
3635
<GenerateDocumentationFile>true</GenerateDocumentationFile>
37-
<SignAssembly>False</SignAssembly>
38-
<DelaySign>True</DelaySign>
36+
<SignAssembly>false</SignAssembly>
37+
<DelaySign>false</DelaySign>
3938
<AssemblyOriginatorKeyFile>35MSSharedLib1024.snk</AssemblyOriginatorKeyFile>
4039
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
41-
<Version>1.9.0</Version>
40+
<Version>1.10.0</Version>
4241
</PropertyGroup>
4342
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netstandard1.1|AnyCPU'">
4443
<DocumentationFile>bin\Release\netstandard1.1\Microsoft.Graph.Core.xml</DocumentationFile>

src/Microsoft.Graph.Core/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
//
2525
// You can specify all the values or you can default the Build and Revision Numbers
2626
// by using the '*' as shown below:
27-
[assembly: AssemblyVersion("1.9.0")]
28-
[assembly: AssemblyFileVersion("1.9.0.0")]
27+
[assembly: AssemblyVersion("1.10.0")]
28+
[assembly: AssemblyFileVersion("1.10.0.0")]
2929

3030
#if DEBUG
3131
[assembly: InternalsVisibleTo("Microsoft.Graph.Core.Test")]

src/Microsoft.Graph.Core/Requests/BaseRequest.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,16 @@ public HttpRequestMessage GetHttpRequestMessage()
302302
return request;
303303
}
304304

305+
/// <summary>
306+
/// Gets a URL that is the request builder's request URL with the segment appended.
307+
/// </summary>
308+
/// <param name="urlSegment">The segment to append to the request URL.</param>
309+
/// <returns>A URL that is the request builder's request URL with the segment appended.</returns>
310+
public void AppendSegmentToRequestUrl(string urlSegment)
311+
{
312+
this.RequestUrl = string.Format("{0}/{1}", this.RequestUrl, urlSegment);
313+
}
314+
305315
/// <summary>
306316
/// Builds the query string for the request from the query option collection.
307317
/// </summary>
160 Bytes
Binary file not shown.

src/Microsoft.Graph/Microsoft.Graph.csproj

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,21 @@
33
<Description>Microsoft Graph Client Library allows you to call Office 365, Azure AD and other Microsoft services through a single unified developer experience.</Description>
44
<Copyright>Copyright (c) Microsoft Corporation</Copyright>
55
<AssemblyTitle>Microsoft Graph Client Library</AssemblyTitle>
6-
<VersionPrefix>1.9.0</VersionPrefix>
7-
<FileVersion>1.9.0</FileVersion>
8-
<AssemblyVersion>1.9.0</AssemblyVersion>
6+
<VersionPrefix>1.10.0</VersionPrefix>
7+
<FileVersion>1.10.0</FileVersion>
8+
<AssemblyVersion>1.10.0</AssemblyVersion>
99
<Authors>Microsoft</Authors>
1010
<TargetFrameworks>netstandard1.1;net45</TargetFrameworks>
1111
<PreserveCompilationContext>false</PreserveCompilationContext>
1212
<AssemblyName>Microsoft.Graph</AssemblyName>
1313
<PackageId>Microsoft.Graph</PackageId>
1414
<PackageTags>Microsoft Office365;Graph;GraphServiceClient;Outlook;OneDrive;AzureAD;GraphAPI;Productivity;SharePoint;Intune;SDK</PackageTags>
1515
<PackageReleaseNotes>
16-
May 2018 Release Summary (version 1.9.0)
16+
July 2018 Release Summary (version 1.10.0)
1717

18-
New features
19-
- Added more comments.
20-
- UserActivity - apps can push information to the user's timeline.
21-
- Updated timezone information.
22-
- Updates to Intune functionality.
23-
- New Outlook functionality which includes an OutlookUser object, categories, coordinates, message rules, and working hours.
24-
- New OneNote functionality which includes a notebook's site collection.
25-
26-
Bug fixes
27-
- Fixed Site GetByPath
18+
- Updated reference to System.Net.Http to address a vulnerability and issue with .Net &gt;=4.7.2.
19+
- Set signing properties in .csproj to be 'false' by default.
20+
- Added custom request builders that help add user activity and history.
2821
</PackageReleaseNotes>
2922
<PackageProjectUrl>https://developer.microsoft.com/graph</PackageProjectUrl>
3023
<PackageLicenseUrl>http://aka.ms/devservicesagreement</PackageLicenseUrl>
@@ -40,11 +33,11 @@ Bug fixes
4033
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
4134
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
4235
<GenerateDocumentationFile>true</GenerateDocumentationFile>
43-
<SignAssembly>False</SignAssembly>
44-
<DelaySign>True</DelaySign>
36+
<SignAssembly>false</SignAssembly>
37+
<DelaySign>false</DelaySign>
4538
<AssemblyOriginatorKeyFile>35MSSharedLib1024.snk</AssemblyOriginatorKeyFile>
4639
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
47-
<Version>1.9.0</Version>
40+
<Version>1.10.0</Version>
4841
</PropertyGroup>
4942
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netstandard1.1|AnyCPU'">
5043
<DocumentationFile>bin\Release\Microsoft.Graph.xml</DocumentationFile>
@@ -54,10 +47,13 @@ Bug fixes
5447
<ProjectReference Include="..\Microsoft.Graph.Core\Microsoft.Graph.Core.csproj" />
5548
</ItemGroup>
5649
<ItemGroup>
57-
<PackageReference Include="System.Net.Http" Version="4.3.1" />
50+
<PackageReference Include="System.Net.Http" Version="4.3.3">
51+
<!--<ExcludeAssets>All</ExcludeAssets>-->
52+
</PackageReference>
5853
</ItemGroup>
5954
<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
6055
<Reference Include="System" />
56+
<Reference Include="System.Net.Http" />
6157
<Reference Include="Microsoft.CSharp" />
6258
<PackageReference Include="Newtonsoft.Json" Version="[6.0.1,12)" />
6359
</ItemGroup>

src/Microsoft.Graph/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
//
2525
// You can specify all the values or you can default the Build and Revision Numbers
2626
// by using the '*' as shown below:
27-
[assembly: AssemblyVersion("1.9.0")]
28-
[assembly: AssemblyFileVersion("1.9.0.0")]
27+
[assembly: AssemblyVersion("1.10.0")]
28+
[assembly: AssemblyFileVersion("1.10.0.0")]
2929

3030
#if DEBUG
3131
[assembly: InternalsVisibleTo("Microsoft.Graph.Test")]
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
namespace Microsoft.Graph
2+
{
3+
using System.Threading;
4+
5+
public partial interface IUserActivitiesCollectionRequest
6+
{
7+
/// <summary>
8+
/// Adds the specified UserActivity to the collection via PUT.
9+
/// </summary>
10+
/// <param name="userActivity">The UserActivity to add.</param>
11+
/// <returns>The created UserActivity.</returns>
12+
System.Threading.Tasks.Task<UserActivity> AddUserActivityAsync(UserActivity userActivity);
13+
14+
/// <summary>
15+
/// Adds or replaces the specified UserActivity to the collection via PUT.
16+
/// </summary>
17+
/// <param name="userActivity">The UserActivity to add.</param>
18+
/// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
19+
/// <returns>The created UserActivity.</returns>
20+
System.Threading.Tasks.Task<UserActivity> AddUserActivityAsync(UserActivity userActivity, CancellationToken cancellationToken);
21+
}
22+
}

0 commit comments

Comments
 (0)