Exemple #1
0
        private static async Task <string> GetThumbnail(AADGraphClient client, string userPrincipalName)
        {
            var result = string.Empty;

            try
            {
                var userPhoto = await client.GetThumbnailAsync(userPrincipalName);

                if (userPhoto != null)
                {
                    result = userPhoto;
                }
            }
            catch (Microsoft.Data.OData.ODataErrorException ex)
            {
                if (ex.Error.ErrorCode == "Request_ResourceNotFound")
                {
                    result = Constants.AnonymPhotoPath;
                }
            }
            catch (Exception e)
            {
                result = Constants.AnonymPhotoPath;
            }
            return(result);
        }
Exemple #2
0
        private static AADGraphClient GetGraphClient()
        {
            var activeDirectoryClient = AuthenticationHelper.GetActiveDirectoryClient();
            var graphClient           = new AADGraphClient(activeDirectoryClient);

            return(graphClient);
        }