When I use the Live Client Auth sdk, I can get a url to a thumbnail for the currently logged in user. How can I get the equivalent thumbnail for a contact of the user?
I know that the contact returned by new ContactPicker().PickSingleContactAsync() has a GetThumbnailAsync method, but that returns a bitmap and I'd rather just use the url. Is that possible? Is there a way to get the profile pic for any arbitrary email?
I know that the contact returned by new
ContactPicker().PickSingleContactAsync() has a GetThumbnailAsync
method, but that returns a bitmap and I'd rather just use the url. Is
that possible?
No. See documentation http://msdn.microsoft.com/en-us/library/windows/apps/br224875.aspx
Is there a way to get the profile pic for any arbitrary email?
Someone else seems to have resolved this. Check the answer at https://stackoverflow.com/a/12082001/2012977
Related
I have a really frustrating issue, where all I want to do is get user images from O365 and simply display them on my web page, which is hosted on Azure azpp service.
As you can see from this SO and this SharePoint.StackExchange question, The images fail to load when simply trying to display the link taken from SharePoint in an <img> tag.
However, after navigating to the image in a a new tab, and refreshing my page, the iamges load fine. can anyone explain this behaviour? it makes no sense to me at all
Anyways since that just dont work for whatever reason (logged in user clearly has the right permissions, as the images do disaply after navigating to them),
I thought I would try downloading the images using graph API.
SO I downloaded the quick start project and trying to download the iamges with
public async Task<Stream> TestAsync(GraphServiceClient graphClient)
{
var users = graphClient.Users;
var jk = users["user.name#domain.com"];
return await jk.Photo.Content.Request().GetAsync();
}
But I just get
Exception of type 'Microsoft.Graph.ServiceException' was thrown.
Yet when I try to view the same image in the API graph explorer, I can download the image. Please can someone just help me to display SharePoint user images in my web page without the user having to first navigate to the image directly.. Why must it be so difficult?
Once you have a valid token, make sure your permission scopes include User.Read.All, for example:
The query:
var user = graphClient.Users["<userPrincipalName>"];
corresponds to the following endpoint
Url: /users/{userPrincipalName}
Method: GET
which requires User.Read.All scope, see permission section for a more details.
In addition, in case of access without a user token requires Administrative Consent before it can be used.
Example
var users = graphClient.Users;
var user = users[accountName];
var photo = await user.Photo.Content.Request().GetAsync() as MemoryStream;
using (var file = new FileStream("./user.jpg", FileMode.Create, FileAccess.Write))
{
if (photo != null) photo.WriteTo(file);
}
I downloaded and setup the example,I uncommented the following in the code.
static public string[] SCOPES = { PlusService.Scope.PlusLogin, PlusService.Scope.UserinfoEmail };
It retrieves my name, friend etc but it does not retrieve my email address.
Is anyone able to assist? Possibly i'm looking in the incorrect place.
I used tested it using Try It. I tested it with all of the different scopes
https://www.googleapis.com/auth/plus.login Know your basic profile
info and list of people in your circles.
https://www.googleapis.com/auth/plus.me Know who you are on Google
https://www.googleapis.com/auth/userinfo.email View your email address
https://www.googleapis.com/auth/userinfo.profile View basic
information about your account
It doesn't appear to matter you get back the email in all of the scopes. But what does matter is that the Users email must be set to public in the Account. If its set to anything else, your circles, only you. its not listed. This appears to be true even when you are trying to see your own information. (Sending Me)
I am using Exchange Web Services trying to find the Organizer of the meeting's email address
I have tried using
Appoint.Organizer.Address
but some of the properties are null (see image).
How do I get the email address of the organizer?
Link to image (sorry not enough rep to embed)
http://i.stack.imgur.com/wSv2r.png
What operation are you using ? If you have just used FindItems then that's what you would expected because only the displayName of the Sender (which is the Organizer) is returned with FindItems. To get the Address property populated you would need to do a GetItem (or Load in the Managed API).Or if you really want to save a call you could try using the PidTagSenderSmtpAddress extended property http://msdn.microsoft.com/en-us/library/office/jj713594(v=office.15).aspx
Cheers
Glen
Do you know how this meeting came into the mailbox? Was it sent from a sender outside of Exchange, or another mailbox in that Exchange organization? What version of Exchange? Also how are you binding to the appointment? It would be good to see that code. I've tried this with a few meetings here and they all have the Address property populated. Your screenshot shows a MailboxType field of "OneOff", and I'm not sure off the top of my head how to make that happen.
Typically "OneOff" refers to a recipient that couldn't be resolved. In this case, you might try taking the information that is present (in this case the display name) and calling ResolveName to see if you can get the address that way.
I'm using Facebook .Net SDK(http://facebooksdk.net/) in my application. I need post an image to the wall of the user or his page.
I have this piece of code to try do this:
var postUrl = "<fbid>/feed";
var fbParameters = new Dictionary<string,object>();
fbParameters["message"] = postRequest.FacebookPostContent;
if (postRequest.MediaData != null && postRequest.MediaData.Length > 0)
{
var stream = new MemoryStream(postRequest.MediaData);
if (postRequest.ContentType.Equals("image/jpeg"))
{
postUrl = postUrl.Replace("/feed", "/photos");
fbParameters["picture"] = new FacebookMediaStream { ContentType = postRequest.ContentType, FileName = DateTime.UtcNow.ToString("ddmmyyyyhhmmss") + "-photo.jpeg" }.SetValue(stream);
}
}
if (!string.IsNullOrWhiteSpace(postRequest.FacebookPageId))
{
fbUserID = postRequest.FacebookPageId;
}
postUrl = postUrl.Replace("<fbid>", fbUserID);
var result = await facebookClient.PostTaskAsync(postUrl, fbParameters);
Look at my postUrl variable. I update the with the user ID in Facebook or the PageID if it is a page so the post should be properly posted in the right object. If there is some image to upload, so add it to the dictionary.
So, with it in mind, I have the following questions:
When the fbUserID is a user ID, the post happens perfectly, with the image and description but, when the ID is a PageID, only the description text is posted and image is just ignored(the user has the manage_page permissions so I dont think it is a permission issue). What I'm doing wrong that the image is not being posted to the page's wall?
If I want to post a video instead of a image, what should I change in this code?
Already saw many problems with other technologies here in SO but never a conclusive solution.
Thank you very much for the help, I really appreciate.
Regards,
Gutemberg
Got it!
Facebook creates a different section inside the page called Recent Posts by Others on Test Page where people allowed to post images will be there, like an attachment icon. In order to post directly to the page's feed/wall, all I need to do is instead of use the user access_token(even if user granted manage_pages permission) just use the access_token that comes in /me/accounts object for the respective page.
About the video post, I just set the ContentType to "video/mpeg" and at server instead of set picture parameter on dictionary, I've set the video field with the video byte[].
Thanks!
Regards,
As an alternative you could try the Share Content button shown in one of the answers here:
Upload video on Facebook using Graph REST API on Windows Phone 8.1
I found that to be easier than tackling authorization and manually posting.
Have gotten the foundation in place, but now, finding myself wanting to play around with my
application's user's profile pictures; I'm stumped....and have been for quite some hours...
Firstly, my oauth_token / access_token is obtained, using the official (though Alpha ;-)
Facebook C# SDK and only utilize the Graph API.
FBapi.Get("/" + friend.Dictionary["id"].String + "/picture");
leads to an exception due to not returning a JSONObject, and
using the complete http://graph.facebook.com/me/picture is forwarded/translated to the image's URL.
Trying a more direct approach didn't pan out either :
WebClient wcImg = new WebClient();
wcImg.DownloadFile("/" + friend.Dictionary["id"].String + "/picture", "name_blame.jpg");
Some details are lacking in my question; I beg your pardon, am very tired and will edit later if uproar commences.
Ideas?
Addendum :
Boy, afflicted by code blindness I was indeed! However, your sensibility gave me what I needed (Zynga, tremble in my canvas ;-).
For sake of curiosity...it appears there's no JSON template(pardon my lack of lingo) available for profile pictures? Then how do one go about obtaining a fleshed out, Graph API Photo of that profile picture (if available)?
The picture in Graph API is a bit special animal. It doesn't return json, it directly forwards to the image. It was made so that you can use this url right in html:
<img src="http://graph.facebook.com/<UID>/picture"> - displays avatar
Now if you need to know actual picture URL it redirects to there are 2 options:
Read redirect headers from that graph URL.
Use FQL:
select pic_square from user where uid=12345
There is alot of other info that can be extracted about a user using FQL (including pictures in other sizes).
Also, if You want to show big profile photo, use this:
http://graph.facebook.com/<UID>/picture?type=large
You can get ALL friends' profile pictures (direct Links to the photos), in a single GET request:
https://graph.facebook.com/me/friends?access_token=[oauth_token]&fields=name,id,picture
Then use Json to Decode the string.. and that's all...
NJoy ^_^