Skip to content

Commit 854b4aa

Browse files
authored
Remove photo from showprofile (#26253)
1 parent 242701c commit 854b4aa

File tree

1 file changed

+0
-40
lines changed
  • src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/Pages

1 file changed

+0
-40
lines changed

src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/Pages/ShowProfile.razor

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -24,61 +24,21 @@ else
2424
<td>Name</td>
2525
<td>@user.DisplayName</td>
2626
</tr>
27-
<tr>
28-
<td>Photo</td>
29-
<td>
30-
@{
31-
if (photo != null)
32-
{
33-
<img style="margin: 5px 0; width: 150px" src="data:image/jpeg;base64, @photo" />
34-
}
35-
else
36-
{
37-
<h3>NO PHOTO</h3>
38-
<p>Check user profile in Azure Active Directory to add a photo.</p>
39-
}
40-
}
41-
</td>
42-
</tr>
4327
</table>
4428
}
4529

4630
@code {
4731
User user;
48-
string photo;
4932

5033
protected override async Task OnInitializedAsync()
5134
{
5235
try
5336
{
5437
user = await GraphServiceClient.Me.Request().GetAsync();
55-
photo = await GetPhoto();
5638
}
5739
catch (Exception ex)
5840
{
5941
ConsentHandler.HandleException(ex);
6042
}
6143
}
62-
63-
protected async Task<string> GetPhoto()
64-
{
65-
string photo;
66-
67-
try
68-
{
69-
using (var photoStream = await GraphServiceClient.Me.Photo.Content.Request().GetAsync())
70-
{
71-
byte[] photoByte = ((System.IO.MemoryStream)photoStream).ToArray();
72-
photo = Convert.ToBase64String(photoByte);
73-
this.StateHasChanged();
74-
}
75-
76-
}
77-
catch (Exception)
78-
{
79-
photo = null;
80-
}
81-
return photo;
82-
}
83-
8444
}

0 commit comments

Comments
 (0)