Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Move cancellation token to correct location * Add comments to AddAsync * Add "id" parameter * Internal constructor comments * Replace invalid characters with HTML * Code comments for constants * ChunkedUpload comments * OneDrive comments * Resolve OneNote comments * Serializer comments * Update out-of-date comments * Core constants * Option comments * Misc missing comments * Collection page comments * Add missing comments * Add response headers to regular requests * Handle case if content is empty * Add SerializeObject method to MockSerializer * .NET Core mock serializer update * Update functional test items * Don't add response headers to void response types * Generate valid serializer response * Response header test * Assert expected headers match response headers * Add documentation on headers * Docs edits * Refactor AddHeadersToResponse * Add stream limitation documentation * generated code files * Add colon to GetByPath URL * Functional test for GetByPath navigation Updated site resource for new tenant * Updates due to cneeded data updates in demo tenant. * Updated package/assembly version, added release notes. * Add DELETE/POST/PATCH to withReferenceRequest on entities * withReferenceRequest interface updates * Remove collection-specific code
- Loading branch information
1 parent
77d8466
commit 524e510
Showing
399 changed files
with
130,056 additions
and
187 deletions.
There are no files selected for viewing
19,796 changes: 19,796 additions & 0 deletions
19,796
GenerationReports/April2018ModelsGenerationReport.html
Large diffs are not rendered by default.
Oops, something went wrong.
92,764 changes: 92,764 additions & 0 deletions
92,764
GenerationReports/April2018RequestsGenerationReport.html
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Headers in the Microsoft Graph .NET Client Library | ||
|
||
|
||
The .NET Client Library allows you to add your own custom request headers and inspect the response headers that come back from the Graph service. | ||
|
||
## Adding request headers | ||
|
||
Custom headers can be added by creating a new option collection and adding it to the request object: | ||
|
||
```csharp | ||
List<Option> options = new List<Option>(); | ||
options.Add(new HeaderOption("Etag", etag)); | ||
options.Add(new HeaderOption("If-Match", etag)); | ||
options.Add(new QueryOption("$filter", filterQuery)); | ||
|
||
var newObject = graphServiceClient | ||
.Object | ||
.Request(options) | ||
.Patch(updatedObject); | ||
``` | ||
|
||
You can also pass headers in individually if you only need to include one header: | ||
|
||
```csharp | ||
var newObject = graphServiceClient | ||
.Object | ||
.Request(new HeaderOption("Etag", etag)) | ||
.Patch(updatedObject); | ||
``` | ||
|
||
## Reading response headers | ||
|
||
HTTP response data is available in the `AdditionalData` property bag of the response object. You can access both the `statusCode` of the response and the `responseHeaders` to get more information, such as the request ID, Content-Type, and other data that may be relevant to you that is not part of the object model inherently. | ||
|
||
To work with the response headers, you can deserialize the data using the client's serializer to make it easy to parse through the header dictionary: | ||
|
||
```csharp | ||
var user = await graphServiceClient....getAsync(); | ||
|
||
var statusCode = user.AdditionalData["statusCode"]; | ||
var responseHeaders = user.AdditionalData["responseHeaders"]; | ||
|
||
// Deserialize headers to dictionary for easy access to values | ||
var responseHeaderCollection = graphClient | ||
.HttpProvider | ||
.Serializer | ||
.DeserializeObject<Dictionary<string, List<string>>>(responseHeaders.ToString()); | ||
|
||
var requestId = responseHeaderCollection["request-id"][0]; | ||
``` | ||
|
||
|
||
*Currently, requests that have a return type of `void` or `Stream` do not return response headers and cannot be inspected.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.