Using Bing API in C# - c#

How do we use the Bing API in C#? I have to pass a query to the Bing API and then get the results.

BingService.BingService service = new BingService.BingService();
SearchRequest request = new SearchRequest();
// use your Bing AppID
request.AppId = ""; /* Your App ID */
request.Query = "rose"; // your search query
// I want to search only web
request.Sources = new SourceType[]
{
SourceType.Image
};
SearchResponse response = service.Search(request);
foreach (ImageResult result in response.Image.Results)
{
//lstBxImages.Items.Add("" + result.Title);
imgliteral.Controls.Add(new LiteralControl("<img src=" + result.MediaUrl + " width=100

Download bing dlls from microsoft site and add those dlls . Then only we can able to use bing service.

Here's something will help you a lot
https://github.com/insatmc/BingMapHelper

Just adding to above there is a full documentation of te API given by BING in a PDF.
Here is a Basic Details Version

hii..
Add a bing reference to web references in an application and use search.wsdl

Related

Get Facebook objects information with C#

I'm new to facebook development. I'm using C# on Windows Form and I'm searching for a way to get information about a post on facebook.
I've read documentation and see that I can use FQL to query facebook object.
My questions:
is using FQL it a good way in WindowsForm solutions ?
I need to get the count on how many 'like' are done on an object (link or photo). Can I do this with like Table ?
I need to know who is sharing my facebook objects (link or photo). Where is the relative Table I can use ?
Thanks for your help.
I haven't had a lot of luck with FQL and prefer to use the graph api
Using this in combination with the facebook SDK dll you can quickly retrieve information about a post as a json object using the following code.
var client = new FacebookClient(accessToken);
var jsonPost = (JsonObject) client.Get(postId);
As for seeing who has shared your objects I'm not sure if that can be done using the graphAPI, you would be able to see likes and comments of a object by using
var client = new FacebookClient(accessToken);
var jsonLikes = (JsonObject) client.Get(postId + "/likes");
var jsonComents = (JsonObject) client.Get(postId + "/comments");

c# program to call Google+ API and Custom Search API from Google

Can you please tell me via a code sample how I can write a C# program that will call
the Google+ API and Custom Search API of Google.
I know there is a brief description of it on :::::
URL:https://developers.google.com/+/api/
URL:https://developers.google.com/custom-search/v1/using_rest
URL:http://code.google.com/p/google-api-dotnet-client/wiki/OAuth2
But the process mentioned in the links in doing the above as given in the documentation is
not very clear.
Is there a simple illustration through C# code that I can use to call Google+ API and Custom
Search API?
The Google API Dotnet Client project contains .NET wrappers form most of Google's APIs, including Google+.
They do have several examples but not for all of their APIs, yet.
A Google+ example from their page to query for public activities is:
CommandLine.EnableExceptionHandling();
CommandLine.DisplayGoogleSampleHeader("PlusService API");
// Create the service.
var objService= new PlusService();
objService.Key = ""; //put in user key.
var acts = objService.Activities.Search();
acts.Query = "super cool";
acts.MaxResults = 10;
var searchResults = acts.Fetch();
if (searchResults.Items != null)
{
foreach (Activity feed in searchResults.Items)
{
//extract any property of uer interest
CommandLine.WriteResult(feed.Title, feed.Actor);
}
}

Facebook C# SDK Get Current User

I m working on a Facebook App. Not a website.
I am trying to use Facebook C# SDK and trying to get Current User and Query Current User info.
How do i do that?
Also, When i try to use an app it s asking for Adding the app, requesting permission to access data, how do i do that also?
Is there a comprehensive examples of these things?
If you're stuck working with .NET 3.5, this will work:
var facebookClient = new FacebookClient(FacebookAccessToken);
var me = facebookClient.Get("me") as JsonObject;
var uid = me["id"];
You need the access token. Once you get the access token make a request to me
var fb = new FacebookClient("access_token");
dynamic result = fb.Get("me", new [] { fields = "id" });
var userId = result.id;

Is there anything out there that will make it easy for me to allow my users to share their Facebook photos (and videos) on my site?

I see a bunch of .NET open source projects out there that look to be able to get at the users information, but I just want a user to be able to "post" media that's already on Facebook on my site as well. Other websites seem to allow you to do embedding of their media (I'm really liking oEmbed) but FB seems a bit of a mystery to me. I have no experience using their API, but I'm guessing it has something to do with the "social graph" part. Anyone else done this before? Did you use something or is this easy enough to do without these OS projects? Any examples anywhere of how someone already did this? I wouldn't think that I'm the first person to want to do this but have searched Google and didn't come up with anything.
Have you tried FQL? Using this I was able to get users display pictures on any site I wanted by simply constructing a simple SQL like query.
The Facebook .NET SDK makes this very easy for you. You can download it here: http://facebooksdk.codeplex.com
Here is an example of how you would publish a photo using that SDK:
string photoPath = #"..\..\..\Facebook.Tests\bin\Release\monkey.jpg";
byte[] photo = File.ReadAllBytes(photoPath);
FacebookApp app = new FacebookApp();
dynamic parameters = new ExpandoObject();
parameters.message = "The message you want to go with the photo...";
var mediaObject = new FacebookMediaObject {
FileName = "monkey.jpg",
ContentType = "image/jpeg",
};
mediaObject.SetValue(photo);
parameters.source = mediaObject;
dynamic result = app.Api("/the_album_id/photos", parameters, HttpMethod.Post);
string photoId = result.id;

Making telephone call from ASP.NET application

I have a requirement that we need to make a telephone call using ASP.NET application.
Our ASP.NET application is used in call center. Currently, they make a call to customer manually. Now, the call should go from our application by clicking the phone number link and starts recording the conversation between the agent (application user) and customer.
What all would be the hardware requirements for the above scenario?
How can we implement telephone calling in asp.net application and what are the required components to implement the same?
Nexmo offers a range of cloud communication APIs including Voice API that allows you to fulfil this requirement.
All you need is to install the Nuget package:
Install-Package Nexmo.Csharp.Client
Then use the Call class:
Call.Do(new Call.CallCommand
{
to = new[]
{
new Call.Endpoint
{
type = "phone",
number = NEXMO_TO_NUMBER
}
from = new Call.Endpoint
{
type = "phone",
number = NEXMO_FROM_NUMBER
},
answer_url = new[]
{
NEXMO_CALL_ANSWER_URL
}
});
Here's a detailed post on how to make a phone call with Nexmo Voice API and ASP.Net
If you want to use phone line you should use Computer-telephony boards, for example Dialogic: http://www.dialogic.com/products/ip_enabled/ip_boards.htm They should have API, so you will be able to use it from your application.
In addition to Asterisk, you might also consider Twilio, a web based telephony service that provides you a rest based api for making and receiving phone calls. See http://www.twilio.com/docs/howto/ for info.
You Can Use Third party API To Make a Call Using Asp.net Code.First You Need To Register. Here's a detailed post on
How To Make a Call Using Asp.net Code
protected void btnCall_click(object sender, EventArgs e)
{
// Call porcessing happens here.
// Use your account SID and authentication token instead of
// the placeholders shown here.
var accountSID = "C0d09f4042d1ff4acb55329cf8e5efb";
var authToken = "05b278c6f3538d3a35f13b25c73dff";
// Instantiate an instance of the Twilio client.
TwilioClient.Init(accountSID, authToken);
// Retrieve the account, used later to retrieve the
var account = AccountResource.Fetch(accountSID);
// this.varDisplay.Items.Clear();
// Retrieve the values entered by the user.
var To =new PhoneNumber(txtMobileNumber.Text);
//twlio=14155992671
var from = new PhoneNumber("+918098641075");
var myMessage = this.txtMessage.Text;
// Create a URL using the Twilio message and the user-entered
// text. You must replace spaces in the user's text with '%20'
// to make the text suitable for a URL.
var url = #"http://twimlets.com/message?Message%5B0%5D={myMessage.Replace()}";
var twimlUri = new Uri(url);
// Display the endpoint, API version, and the URL for the message.
this.varDisplay.Items.Add(#"Using Twilio endpoint { }");
this.varDisplay.Items.Add(#"Twilioclient API Version is {apiVersion}");
this.varDisplay.Items.Add(#"The URL is {url}");
// Place the call.
var Call=CallResource.Create(To,from,url:twimlUri);
// var call = CallResource.create(to, from, url: twimlUri);
this.varDisplay.Items.Add("Call status: " + Call.Status);
}

Categories