Skip to content

responseHeaders serialized into requests in version 1.9.0 #270

@DumboJetEngine

Description

@DumboJetEngine

After upgrading to the 1.9.0 version, I have noticed a new bug.
(I use the latest Visual Studio 2017 on Win10 and the same code used to work on a previous version of the lib)

Code:

// Fetch
var messageRequestBuilder = _graphClient
    .Me
    .Messages[msgId];

message = await messageRequestBuilder
    .Request(new Option[] { })
    .GetAsync();

message.Attachments = await messageRequestBuilder
    .Attachments
    .Request()
    .Select("Name,Size,ContentType")
    .GetAsync();

// Update
message.Subject = subject
message.Body.Content = html;
await _graphClient
    .Me
    .Messages[mail.Mail.Id]
    .Request()
    .UpdateAsync(message);

Expected behavior

Update the draft message.

Actual behavior

I get the following error:

{
  "error": {
    "code": "RequestBodyRead",
    "message":
      "The property 'responseHeaders' does not exist on type 'Microsoft.OutlookServices.Message'. Make sure to only use property names that are defined by the type or mark the type as open type.",
    "innerError": {
      "request-id": "f4c92dc0-6aca-4325-a360-60309e3da493",
      "date": "2018-05-14T19:05:05"
    }
  }
}

Looking at the request your library produces, I see that it includes a responseHeaders property in the JSON, containing headers (I guess) from the original request that fetched the message (before updating it with the new data).

Steps to reproduce the behavior

Use the code above with version 1.9.0.


The same issue (giving the same exception) happens using this code:

// Mark message as Read
private async Task MarkEmailAsRead(string msgId, bool makeItRead = true) {

    var messageRequestBuilder = _graphClient
        .Me
        .Messages[msgId];

    var c = messageRequestBuilder
        .Request()
        .Select("IsRead");

    var msg = await c.GetAsync();
    if (msg.IsRead == makeItRead) return;    
    msg.IsRead = makeItRead;
    await c.UpdateAsync(msg);
}

MarkEmailAsRead(msgId, true);

Also, for the love of God, providing some extra sample code showing how to use your client would help people very much. You cannot believe what I went through to produce those samples and now they have stopped working all of the sudden and I have no idea what to do!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions