xaml - Office 365 API - Azure Active Directory bring user's thumbnail Failed -



xaml - Office 365 API - Azure Active Directory bring user's thumbnail Failed -

i'm using next code sample : here user's thumbnail of there's business relationship on office 365 tenant windows 8.1 project xaml/c#

try { using (var dssr = await user.thumbnailphoto.downloadasync()) { var stream = dssr.stream; var buffer = new byte[stream.length]; await stream.readasync(buffer, 0, (int) stream.length); profileimage = buffer; } } grab (exception ex) { debug.writeline(ex); }

however each time seek bring user's thumbnail photo, next error:

"resource 'thumbnailphoto' not exist or 1 of queried reference-property objects not present."

i'm using admin user (global admin) in add together connected service , sign in .

i searched said on : here

"and these photos stored in exchange mailbox rather thumbnail photo in azure advertisement or local advertisement (this may key piece looking for). so, photo stored in exchange , replicated or copied aad."

but didn't find thing useful .

will please help me

i found out thumbnailphoto attribute populated in waad if synchronization happens local active directory (e.g. using dirsync). so, default, not find field in directory. place find profile image on exchange. left download image exchange ( require authentication).

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 remote file found, download oit using (stream inputstream = response.getresponsestream()) { byte[] buffer = new byte[4096]; int bytesread; { 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); } }

xaml windows-runtime office365

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -