Integrate Microsoft Office Communicator 2007 in ASP.NET Page - c#

I am working on a website build using ASP.NET and C# for my company's intranet.So is it possible to integrate the Microsoft Office Communicator 2007 in ASP.NET Page. i.e. the site should be able to provide the current status(avalible, busy , offline) of all contacts and when a user clicks on the username, the chat window should open.

Assuming the client machine is running Communicator, Office and IE, by far the simplest way is to use the NameCtrl in client-side script - the example below should gives the basic concepts. This will also give you the most bang-for-buck in terms of functionality. Hover over the "Your Contact" text to see the persona menu pop up.
For a real world solution, you'd just need to implement an image that changes depending on the presence state that gets returned (i.e. a presence bubble to display alongside each users name), and a collection of sip uris to images, to ensure you can map an incoming status change to the relevant image.
It's worth bearing in mind that the Ajax/CWA solution mentioned in the other answer will most likely not work with Lync Server (I believe Communicator Web Access is no more) so you'd need to change the solution if your company upgrades to Lync. I've tested the solution below, and it works with the Lync Server RC.
<script>
var sipUri = "your.contact#your.domain.com";
var nameCtrl = new ActiveXObject('Name.NameCtrl.1');
if (nameCtrl.PresenceEnabled)
{
nameCtrl.OnStatusChange = onStatusChange;
nameCtrl.GetStatus(sipUri, "1");
}
function onStatusChange(name, status, id)
{
// This function is fired when the contacts presence status changes.
// In a real world solution, you would want to update an image to reflect the users presence
alert(name + ", " + status + ", " + id);
}
function ShowOOUI()
{
nameCtrl.ShowOOUI(sipUri, 0, 15, 15);
}
function HideOOUI()
{
nameCtrl.HideOOUI();
}
</script>
<span onmouseover="ShowOOUI()" onmouseout="HideOOUI()" style="border-style:solid">Your Contact</span>

Related

how to get back the "payload" of the button " Get Started " in c#

I work with Microsoft Bot Framework in Messenger and I would like to know how to get back the "payload" of the "Get Started" button. Which function I should create in C#?
You don't have to - the payload is returned as a regular message, so you can just use this:
if (activity.ChannelId == "facebook" && activity.Text == "GET_STARTED_PAYLOAD")
{
// etc
Note that the documentation lists some restrictions on this feature:
The welcome screen is only shown the first time the user interacts with the Page on Messenger.
Only admins, developers, and testers of the app can see it when the app is in development mode.
Your app must be subscribed to postback webook events.

CS0103: The name 'test' doesn't exist in the actual context

I'm coding a mobile app who should save some infos in a private remote database.
Of course, I can't access public websites of my enterprise to implement a webservice. On the other hand, we have a mailbox with a permanently activated macro who is able to activate another macro when it receives an email with a predefined subject. So, potentially, that 'robot' can save infos I want it to save.
I had to think at different solutions, I choosed one, but I am less and less sure of my choice.
Anyway, my mobile app is developed with Cordova and Ionic Framework. I didn't want to implement a plugin to open my user's mail client, I wanted my mail to be sent automatically.
Finally, I found SendGrid, I thought I could implement it directly in my mobile app, but I didn't make it (If somebody dit it, could you tell me so ? It could delete some steps in my app)
So I reflected about put a third actor in my process. PHP appeared as the best : I'm used to it, and I know we can easily send an email while the SMTP is defined ... It's too bad I can't implement webservices in public websites of my enterprise ^^
Another solution appeared to me : to use Microsoft's Azure service. So i created an ASP.net app of which here is the only sample of code. That method sends correctly my email (the first thing I wanted to verify), but it's unable to recover my form's data.
I wanted to use Request.Form.Keys to see what does it recover before I treat my data, and it didn't recover anything so I didn't understand.
I finally created that test String to delete a doubt who was growing. I put a breakpoint on the next line, where my Datetime is instantiate, to see what was in my test ... and it doesn't exist.
Here is the error I can see with my breakpoint :
AzureSendgrid.Controllers.HomeController.SendMail() : test value is error CS0103: The name 'test' doesn't exist in the actual context
public void SendMail()
{
//System.Collections.Specialized.NameObjectCollectionBase.KeysCollection test = Request.Form.Keys;
String test = "test";
System.Diagnostics.Debug.Write(test);
DateTime now = DateTime.Now; // Here is a breakpoint
// Create the email object first, then add the properties.
SendGridMessage myMessage = new SendGridMessage();
myMessage.AddTo(emailTo);
myMessage.From = new MailAddress(emailFrom, "Appli Mobile");
myMessage.Subject = "Appli Mobile Testing SendGrid";
myMessage.Text = "Date-Heure d'envoi : " + now.Day + "/" +
now.Month + " " + now.Hour + ":" + now.Minute + ":" + now.Second;
//myMessage.AddAttachment
// Create a Web transport, using API Key
var transportWeb = new Web(api_key)
// Send the email.
//var t = transportWeb.DeliverAsync(myMessage);
}
That error is pretty clear, and I could have understand it if there was not juste one line between the initialization and use of my test variable.
If anyone can see anything to help me, it would be nice !
Sorry for potential errors in this message, I'm French.

Selenium Webdriver automation with emails

I'm currently trying to use Selenium Webdriver (C#) to automate a Forgot Password -> Reset Password workflow, where the user navigates to a page and supplies their username, and the backend code validates the username, then sends an email with a reset password link to the email address associated with their account.
I'm able to automate the process up to the point where the code sends the email, but I don't know any ways of checking for the email and/or clicking a link in the email, so I was hoping someone more experienced with Selenium/automation may be able to give me a few pointers.
Ideally the test should not care about the email address that the email is being sent to. Is there a way for Selenium WebDriver or some 3rd party package to catch the email being sent?
Thanks for any input or suggestions.
No. You are talking about setting up an email server, which is not an easy task.
You should send it to a test work email (if this is for a company), or a public email (hotmail/gmail), or if security is not an issue at all, the easiest place to send it would be a disposable email (mailinator)
You could try PutsBox. You can send an email to whatever-you-want#putsbox.com, wait for a few seconds (SMTP stuff ins't instantaneous) then check your email via http://preview.putsbox.com/p/whatever-you-want/last.
Have a look at this post tutorial, it can give you some ideas.
There is no integration of selenium with email clients like Thunderbird/Outlook. But if you have a web interface of the same email client, then you can access the email from browser and using selenium you can read and respond to the emails. I have tried this recently and it works fine where I have used web Outlook for testing.
Hope this helps.
Hi I was in a similar situation and was able to successfully implement a way to get an activation or forgotten password links.
Using Java Mail API I was able to trigger a method when such action is performed which goes into a Folder and read a specific message line then get the link and open it up in a browser using WebDriver.
However the main drawback with this is the inconsistency of reading a specific folder, sometimes emails goes to spam or other folder (in case of Gmail the new Social Folder) making it invisible or difficult to be retrieved.
Overall i think its a process that shouldn't really be automated, In terms of testing it should be done more code base level by mocking responses.
Snippet below should give you an idea on how to go about implementing
public class RefactoredMail {
public static void main(String[] args) {
Properties props = new Properties();
props.setProperty("mail.store.protocol", "imaps");
try {
Session session = Session.getInstance(props, null);
Store store = session.getStore();
store.connect("imap.gmail.com", "username", "password");
Folder inbox = store.getFolder("INBOX");
inbox.open(Folder.READ_ONLY);
Message msg = inbox.getMessage(inbox.getMessageCount());
Address[] in = msg.getFrom();
for (Address address : in) {
System.out.println("FROM:" + address.toString());
}
Multipart mp = (Multipart) msg.getContent();
BodyPart bp = mp.getBodyPart(0);
System.out.println("SENT DATE:" + msg.getSentDate());
System.out.println("SUBJECT:" + msg.getSubject());
System.out.println("CONTENT:" + bp.getContent());
System.out.println("Activation Link:" + ((String)
bp.getContent()).startsWith("http"));
String [] line = new String[1];
line [0] = mp.getContentType().toString();
System.out.println("Activation Link:" + (mp.getBodyPart(0).getLineCount()));
System.out.println("Activation Link:" +line[0]);
} catch (Exception e) {
e.printStackTrace();
}
//WebDriver Stuffs
public String activationUrl() {
//getting the url link and making it a global variable .... etc
//Accessing the link
}
}
You can use https://github.com/cmendible/netDumbster or http://ndumbster.sourceforge.net/default.html. I've used one i forget which. This will host an smtp listener and allow you to make assertions against any email it receives. Its kind of awesome! The caveat is you need to be able to control where the server delivers mail in the environment you are testing.

A system that intergates with Tibco spotfire

I want to develop a system that integrates with Tibco Spotfire and is able to Retrieve Visualizations rendered by Spotfire and expose them for WYSIWYG manipulation. Is this possible?
If so someone please offer guidance. I want to use C# and ASP.NET
first load the javascriptapi for handling client interactions
<script type="text/javascript" src="http://domainname/SpotfireWeb/GetJavaScriptApi.ashx?Version=3.1" > </script>
add the code for adding the spotfire template to web page
create a javascript file in your project with the code below:
function addPlayer()
{
var fileInfo = new FileInformation(SpotfireVisualizationPath,SpotfireVisualizationName,SpotfireParameter, '');
var customization = new spotfire.webPlayer.Customization();
customization.showCustomizableHeader = false;
customization.showToolBar = false;
customization.showClose = false;
customization.showTopHeader = false;
if (app != null)
{
app.close();
}
app = new spotfire.webPlayer.Application(SpotfireWebPlayerURL, customization);
app.open(fileInfo.path, 'SpotfireContainer', fileInfo.parameters);
}
The Spotfire Web Player (which I assume you refer to) is not built in this way - in its current implementation it is more like a remote desktop session to the desktop Spotfire application (if you replace the remote desktop technology with html and javascript).
It simply is not built to be able to grab pieces of the UI for reuse in other contexts. The closest you can do is host the entire web player UI in an iframe and use the javascript API for client-side interactions. By creating single-visualization pages and removing all chrome (toolbars etc) you can get to something that appears to be a single visualization on a page, but it's really just a hack.

How do I get Google Calendar feed from user's access token?

Using OAuth I do get access token from Google. The sample that comes with Google and even this one:
http://code.google.com/p/google-api-dotnet-client/source/browse/Tasks.SimpleOAuth2/Program.cs?repo=samples
show how to use Tasks API. However, I want to use Calendar API. I want to get access to user's calendar. Can anybody tell me how do I do that?
Take a look at the samples:
Getting Started with the .NET Client Library
On the right side of the page linked above there is a screen shot showing the sample projects contained in the Google Data API solution. They proofed to be very helpful (I used them to start my own Google Calendar application).
I recommend keeping both your own solution and the sample solution open. This way you can switch between the examples and your own implementation.
I also recommend to use the NuGet packages:
Google.GData.AccessControl
Google.GData.Calendar
Google.GData.Client
Google.GData.Extensions
and more ...
This way you easily stay up to date.
Sample to get the users calendars:
public void LoadCalendars()
{
// Prepare service
CalendarService service = new CalendarService("Your app name");
service.setUserCredentials("username", "password");
CalendarQuery query = new CalendarQuery();
query.Uri = new Uri("https://www.google.com/calendar/feeds/default/allcalendars/full");
CalendarFeed calendarFeed = (CalendarFeed)service.Query(query);
Console.WriteLine("Your calendars:\n");
foreach(CalendarEntry entry in calendarFeed.Entries)
{
Console.WriteLine(entry.Title.Text + "\n");
}
}

Categories