How do i Get profile photo of specific resolution using Microsoft graph sdk - microsoft-graph-sdks

How do I get profile pic of specific resolution using graph service client sdk ?
using below code I get profile pic of only one resolution i.e. 360* 360
graphServiceClient.Users["serviceprincipal"].Photo.Content.Request().GetAsync().Result
Thanks,

After R&D , found the answer
var graphServiceClient= new GraphServiceClient(
new DelegateAuthenticationProvider(
(requestMessage) =>
{
requestMessage.Headers.Authorization = new AuthenticationHeaderValue("Bearer", response.access_token);
return Task.FromResult(0);
}));
graphServiceClient.Users["serviceprincipal"].Photos["64x64"].Content.Request().GetAsync().Result

Related

Text To Speech universal app doesn't work

This code doesn't work in windows universal app 10
var mediaPronunciation = new MediaElement();
using (var speech = new SpeechSynthesizer())
{
speech.Voice = SpeechSynthesizer.AllVoices
.First(i => i.Gender == VoiceGender.Male);
var voiceStream = await speech.SynthesizeTextToStreamAsync("fast");
mediaPronunciation.SetSource(voiceStream, voiceStream.ContentType);
mediaPronunciation.Play();
}
I've got this error
{"The specified module could not be found. (Exception from HRESULT: 0x8007007E)":null}
I find this topic and he has same problem
How do you make Speech to Text work in Windows (Phone) 8.1 Universal App
please help how can I fix this problem?
thanks
var speech= new SpeechSynthesizer();
speech.Voice = SpeechSynthesizer.AllVoices
.First(i => i.Gender == VoiceGender.Male);
SpeechSynthesisStream sss =await speech.SynthesizeTextToStreamAsync("fast");
mediaPronunciation.SetSource(sss, sss.ContentType);
mediaPronunciation.Play();
Try this...
Finally I fix this,
every one have to download this file for player :
Download and install media pack for N SKU of Windows 10 introduced
, Now you can enjoy use Text To Speech
thanks a lot Mr. Fred -> My question in MSDN

Flickr API image unavailable windows phone

I'm trying to use flicke's api to import images into a Windows Phone app and display them on the phones panoramic dispaly.
I'm new to flickr's API and am stuck ATM.
I've tried the following call:
// original string flickString = "https://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=cc9babb2754c1d29837bea480c97013e&text=game+of+thrones&format=json&nojsoncallback=1&api_sig=bb86a60e9e42f31950bf53d25fc45f08";
string flickString = "https://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=cc9babb2754c1d29837bea480c97013e&text=game+of+thrones&extras=url_sq%2C+url_t%2C+url_s%2C+url_q%2C+url_m%2C+url_n%2C+url_z%2C+url_c%2C+url_l%2C+url_o+&format=json&nojsoncallback=1&api_sig=9e74e094d8c6a7496fc66e070f5c0898";
var baseUrl = string.Format(flickString, flickrAPIKey);
string flickrResult = await client.GetStringAsync(baseUrl);
FlickrData flickrApiData = JsonConvert.DeserializeObject<FlickrData>(flickrResult);
if(flickrApiData.stat == "ok")
{
foreach (Photo data in flickrApiData.photos.photo)
{
// To retrieve one photo
// http://farm{farmid}.staticflickr.com/{server-id}/{id}_{secret}{size}.jpeg
//string photoUrl = "http://farm{0}.staticflickr.com/{1}/{2}_{3}_o.jpeg";
//string photoUrl = "http://farm{0}.staticflickr.com/{1}/{2}_{3}_b.jpeg";
//string photoUrl = "http://farm{0}.staticflickr.com/{1}/{2}_{3}_n.jpg";
string photoUrl = "http://farm{0}.staticflickr.com/{1}/{2}_{3}"
string baseFlickrUrl = string.Format(photoUrl,
data.farm,
data.server,
data.id,
data.secret);
flickr1Image.Source = new BitmapImage(new Uri(baseFlickrUrl));
break;
}
}
}
When I deploy and run the app I get an image saying that this image is unavailiablemessage every time? I've tried changing the search terms etc and still get the sme message. Which is making me wondor if I've missed something setting up my account with flickr earlier that I'm not aware of? It's very frustrating - help please.
Thanks to card_master for his help so far
I'm also integrating with Flickr. I'm creating a web site that uses their api.
I'm using FlickrNet. This is an open source .net library that you can use to call the Flickr Services. This is a C# library.
The benefit of using it on a mobile application you can take advantage of the caching. It allows you to store images in the phones storage. This won't work on a web application though.

Map route not working in Titanium Appcelerator

i'm having some trouble with Maps Route y Maps V2 on Android. So the problem is when i put a route, like this:
var cord1= {
latitude:29.078685,
longitude:-110.971205,
};
var cord2= {
latitude:29.081496,
longitude:-110.959232,
};
var route1 = [cord1, cord2];
var route = MapModule.createRoute({
points : route1,
color : "red",
width : 5.0
});
$.mapview.addRoute(route);
And yeah, now i have a map route in my map, but the route is straight, totally straight
Picture of the map route!
The route is not using the streets, is just a straight line, not sable at all, can you help me?
My specifications:
Mac OS Maverick
Module: Ti.map (API V2)
Titanium SDK 3.2.2.GA
Titanium Studio, build: 3.2.1.201402041146
(c) Copyright 2012-2013 by Appcelerator, Inc. All rights reserved.
Build: jenkins-titanium-rcp-master-95 (origin/master)
Date: 04 February 2014, 11:47:38
You need more coordinates not just a start an end but many points in between. Since this is just one route, your coordinates must be stored in an array consecutively. That array should be used for the points property when creating a route. Here's an example from appecelerator's documents and the route examples are at the very bottom of the page: http://docs.appcelerator.com/titanium/3.0/#!/guide/Native_Maps_and_Annotations
Like this:
var _points = []; // The array used to contain the points in a route
//Your coordinates
var cord1= {
latitude:29.078685,
longitude:-110.971205,
};
_points.push(cord1);
var cord2= {
latitude:29.081496,
longitude:-110.959232,
};
_points.push(cord2);
// Create your route
var route = MapModule.createRoute({
points : _points,
color : "#f00",
width : 5.0
});
// Add route to map!
$.mapview.addRoute(route);
In titanium if you provide only two points in route then it will draw a straight line between those points. If you want to make more accurate route, then try to provide more [cords] points.
try KitchenSink
I too was stuck with the same problem But find a solution to this . The solution is using a Google Places API that provides you points between your starting and destination points as a result a more accurate route is drawn on the map!!!!Hope this works for you .

NotificationHubNotFoundException Windows Phone 8

While I´ve been trying to make the basic notification hub tutorial work on my Windows Phone solution with the following code
var channel = HttpNotificationChannel.Find("MyPushChannel3");
if (channel == null)
{
channel = new HttpNotificationChannel("MyPushChannel3");
channel.Open();
channel.BindToShellToast();
}
channel.ChannelUriUpdated += new EventHandler<NotificationChannelUriEventArgs>(async (o, args) =>
{
var hub = new NotificationHub("http://messaging-ns.servicebus.windows.net/messagingt", "---MY CONECTION STRING---");
await hub.RegisterNativeAsync(args.ChannelUri.ToString());
});
I get a NotificationHubNotFoundException in the await line with the following message
HTTP request failed.
HTTP Details:
Status: 404
Reason: Not Found
Full content: 404No service is hosted at the specified address..TrackingId:2e4b1100-18de-4b24-bbec-68516ddc3b60_G4,TimeStamp:2/2/2014 1:30:23 AM
I tried a number of options for the first parameter of the NotificationHub constructor called "notificationHubPath" with no luck to get my app registered. Anyone has faced this error in the past. Unfortunately there are not enough documentation in how does this constructor works in MDSN.
Thanks
When creating the NotificationHub type object, try by passing just the hub name with the connection string, not the whole address:
var hub = new NotificationHub("messagingt", "---CONECTION STRING---");
I had the same issue, and after close/open VS2013, restart PC and change Wifi/3g connection it worked again like before... strange, i suppose that was a internet connection issue.
you can use fiddler to show more information, i forgot in my case...

Uniquely identify a user on WinRT and WP8 using (f.ex.) LiveID?

I am looking for a way to uniquely identify a user in WinRT and preferably in WP8 as well. In WP7 applications, I could get a hash of the Live ID to do this, but I am not sure of how to approach this in WinRT environment. One of the goals here is to identify the user in Windows 8 environment as a whole. Using LiveID in one form or another would be ok in this case. I found some sources but they also mentioned that this might require some Enterprise Security permissions (or such) that are not welcome in the Windows Marketplace.
Say I want to identify the user based on the live id, I want to do it automatically and across multiple devices (PC, Tablet, maybe WP8). What resources should I be looking for?
You can obtain ID of each live user if you are using Live SDK. Here's code for you.
private async Task<string> GetLiveUserId()
{
string ID = "";
var auth = new LiveAuthClient();
var loginResult = await auth.LoginAsync(new string[] { "wl.signin", "wl.basic" });
if (loginResult.Status == LiveConnectSessionStatus.Connected)
{
var liveClient = new LiveConnectClient(loginResult.Session);
var myData = await liveClient.GetAsync("me");
ID = myData.Result["id"].ToString();
}
return ID;
}