Xaml Office 365 API-Azure Active Directory为用户带来';s缩略图失败

Xaml Office 365 API-Azure Active Directory为用户带来';s缩略图失败,xaml,windows-runtime,office365,Xaml,Windows Runtime,Office365,我使用此示例中的以下代码: 要将用户在office 365租户上的帐户的缩略图获取到windows 8.1项目XAML/c中,请执行以下操作# 但是每次我尝试带用户的缩略图照片时,都会出现以下错误: "Resource 'thumbnailPhoto' does not exist or one of its queried reference-property objects are not present." 我正在使用添加连接服务中的Admin用户(全局管理员)进行

我使用此示例中的以下代码: 要将用户在office 365租户上的帐户的缩略图获取到windows 8.1项目XAML/c中,请执行以下操作#

但是每次我尝试带用户的缩略图照片时,都会出现以下错误:

"Resource 'thumbnailPhoto' does not exist
           or one of its queried reference-property objects are not present."
我正在使用添加连接服务中的
Admin
用户(全局管理员)进行登录

我搜索他们在网上说的话:

“这些照片实际上存储在Exchange邮箱本身,而不是Azure广告或本地广告中的缩略图照片(这可能是您要查找的关键部分)。因此,照片很可能存储在Exchange中,并实际复制或复制到AAD。”

但我没有发现任何有用的东西


能否请您帮助我

我不确定如何使用Office 365 API解决此问题,但如果您想查看另一种路径,以获取目录中的用户缩略图,您可以查看 嗯
V.

我发现只有在从本地Active Directory(例如使用DirSync)进行同步时,才会在WAAD中填充thumbnailPhoto属性。因此,默认情况下,在目录中找不到该字段。当前,您可以在Exchange上找到配置文件图片的唯一位置。因此,您可能只能从Exchange下载图片(需要身份验证)

"Resource 'thumbnailPhoto' does not exist
           or one of its queried reference-property objects are not present."
string completeUrl = "https://outlook.office365.com/ews/exchange.asmx/s/GetUserPhoto?email=your_email@domain.com&size=HR240x240";

WebRequest request = WebRequest.Create(completeUrl);

request.Credentials = new NetworkCredential("your_email@domain.com", "YourPassword");

HttpWebResponse response = (HttpWebResponse)(await request.GetResponseAsync());

            if ((response.StatusCode == HttpStatusCode.OK ||
   response.StatusCode == HttpStatusCode.Moved ||
   response.StatusCode == HttpStatusCode.Redirect) &&
   response.ContentType.StartsWith("image", StringComparison.OrdinalIgnoreCase))
            {

                // if the remote file was found, download oit
                using (Stream inputStream = response.GetResponseStream())
                {

                    byte[] buffer = new byte[4096];
                    int bytesRead;
                    do
                    {
                        bytesRead = await inputStream.ReadAsync(buffer, 0, buffer.Length);
                    } while (bytesRead != 0);

                    StorageFolder tempfolder = Windows.Storage.ApplicationData.Current.TemporaryFolder;
                    await tempfolder.CreateFileAsync("UserProfilePicture", CreationCollisionOption.ReplaceExisting);
                    StorageFile tempfile = await tempfolder.GetFileAsync("UserProfilePicture.png");
                    await FileIO.WriteBytesAsync(tempfile, buffer);
                }
            }