microsoftgraph / msgraph-sdk-serviceissues

Tracks service issues for follow up.
5 stars 0 forks source link

Got error when call to set photo for given user #116

Open fhlbdvt opened 2 years ago

fhlbdvt commented 2 years ago

When using Microsoft.Graph.Beta version 4.14.0-preview to update a user photo, got the following error:

var result = await betaClient.Users[objectId].Photo.Content.Request().PutAsync(memoryStream);
// got error below
Status Code: NotFound
Microsoft.Graph.ServiceException: Code: UnknownError
Message: {
  "errorCode": "ErrorUserResolutionFailedUserDoesNotExist",
  "message": "Exception of type 'Microsoft.Fast.Profile.Core.Exception.ProfileNotFoundException' was thrown.",
  "target": null,
  "details": null,
  "innerError": null,
  "instanceAnnotations": []
}
Inner error:
    AdditionalData:
    date: 2021-10-20T22:36:50
    request-id: a495d3f1-a55c-45b7-9e67-3b8f2afb18f7
    client-request-id: a495d3f1-a55c-45b7-9e67-3b8f2afb18f7
ClientRequestId: a495d3f1-a55c-45b7-9e67-3b8f2afb18f7

and call to get user is successful:

var result = await betaClient.Users[objectId].Request().GetAsync();
// got result back
andrueastman commented 2 years ago

Hey @fhlbdvt,

Thanks for raising this issue. Is the user you are trying to set the photo a newly created user?

fhlbdvt commented 2 years ago

No, it is not a newly created user.

andrueastman commented 2 years ago

We've raised this with the relevant API team here and will revert with any feedback received.

andrueastman commented 2 years ago

Hey @fhlbdvt,

Any chance you are still able to replicate this error? The team wishes to confirm if its transient and it would be great if you could share the error response as you did above.

fhlbdvt commented 2 years ago

I'll try to reproduce and post the result here.

fhlbdvt commented 2 years ago

Got the same error:

Microsoft.Graph.ServiceException : Code: UnknownError
Message: {
  "errorCode": "ErrorUserResolutionFailedUserDoesNotExist",
  "message": "Exception of type 'Microsoft.Fast.Profile.Core.Exception.ProfileNotFoundException' was thrown.",
  "target": null,
  "details": null,
  "innerError": null,
  "instanceAnnotations": []
}
Inner error:
    AdditionalData:
    date: 2021-11-08T17:39:56
    request-id: 0f09b6c8-1149-4a68-9127-8dff4fe693a3
    client-request-id: 0f09b6c8-1149-4a68-9127-8dff4fe693a3
ClientRequestId: 0f09b6c8-1149-4a68-9127-8dff4fe693a3
bdukes commented 2 years ago

I'm seeing the same issue, also not for newly created users. These are Azure AD B2C users, if that matters. I've switched to the beta API to see if that affected things, but it doesn't appear to. Here's the calling code:

public async Task UpdateUserPhoto(Guid userId, string contentType, Stream photoContent)
{
    using var request = new HttpRequestMessage(HttpMethod.Put, $"https://graph.microsoft.com/beta/users/{userId}/photo/$value");
    request.Content = new StreamContent(photoContent) { Headers = { ContentType = MediaTypeHeaderValue.Parse(contentType), }, };
    await this.GraphClient.AuthenticationProvider.AuthenticateRequestAsync(request);
    await this.GraphClient.HttpProvider.SendAsync(request);
}

And here's the error response:

{
  "error": {
    "code": "UnknownError",
    "message": "{\r\n  \"errorCode\": \"ErrorUserResolutionFailedUserDoesNotExist\",\r\n  \"message\": \"Exception of type 'Microsoft.Fast.Profile.Core.Exception.ProfileNotFoundException' was thrown.\",\r\n  \"target\": null,\r\n  \"details\": null,\r\n  \"innerError\": null,\r\n  \"instanceAnnotations\": []\r\n}",
    "innerError": {
      "date": "2021-11-15T21:13:35",
      "request-id": "c768e5eb-3666-41f9-8ed4-d953e98092c4",
      "client-request-id": "c768e5eb-3666-41f9-8ed4-d953e98092c4"
    }
  }
}
fhlbdvt commented 2 years ago

Are there any updates on this issue?

petrhollayms commented 5 months ago

Thank you for reporting this issue. This appears to be an issue or limitation with the service APIs. Unfortunately, as the Microsoft Graph SDK team, we do not have ownership of the APIs that are causing you issues. We invite you to create a question about the service API to Microsoft Q&A and tagged with one of the [microsoft-graph-*] tags, that way it will get routed to the appropriate team for them to triage.

Microsoft Graph | Support or https://aka.ms/askgraph

For now, we will close the issue on our side but feel free to open it in the relevant repository if you think the issue is specific to SDK.

Please let us know if this helps!

Note: We will close this repository on April 19, 2024.