is there a way i can receive messages using SKYPE4COM .dll? I am sending messages to a specific user using skype.SendMessage(). How can i receive them? I am working in a form application in visual studio c# and i would like to make a windows form to pop up everytime i receive a message. I amusing skype4com.dll. Please help.
Can you please write a little code that was testes and works? thx
The official example is for Delphi: http://developer.skype.com/delphi-examples/chatmessages-pas
But you do it in the same way. Simply subscribe on the OnMessageStatus event.
did a bit of googling:
http://www.youtube.com/watch?v=8CMuSXQDMYs
http://www.codeproject.com/KB/cs/SkypeBot.aspx?q=skype4com+message+event+c%23
I know the answer is very late but I think the code can help other programmers having the same problem (code from vsnippets.com):
Skype skype = new Skype();
skype.MessageStatus += new _ISkypeEvents_MessageStatusEventHandler(incommingMessage);
private void incommingMessage(ChatMessage msg, TChatMessageStatus status)
{
string sender = msg.Sender.Handle; // Skype name of sender!
string message = msg.Body; // Message content
DateTime sendTime = msg.Timestamp; // Time when the sender has sended the message.
MessageBox.Show(String.Format("Your contact {0} sended you a message at {1}:\n\n{2}", sender, sendTime.ToString("yyyy-MM-ddTHH:mm:ss.fff"), message), "New Message");
}
(Code not tested yet but it should work)
Related
I've a problem with my VSTO application for Outlook. I want to process the email body from a selected e-mail.
For selected e-mails out of the "default" list this code works fine:
Object selItem = Globals.ThisAddIn.Application.ActiveExplorer().Selection[1];
Outlook.MailItem mailItem = (Outlook.MailItem)selItem;
return mailItem.Body;
But if a user opens an email from the list with a double click, the email is displayed in a new window. If the addin is executed in this window (over the ribbon), the email from the list is still used (which is now in the background).
Is there a way to find out if the plugin was started in a separate window and then get the email body from it?
Regards,
Florian
Coincidentally, I just dealt with something similar to this. My situation isn't identical, but since I could easily piece together what it seems like you're looking for see below. I haven't tested this, and obviously you'll have to handle passing the correct reference to your Outlook Application, but since i had this immediately available I figured it would pass it along with the hope that you'll find it helpful.
private static void ribbonButton_Click(object sender, RibbonControlEventArgs e)
{
Outlook.Application application = new Outlook.Application();
Outlook.Inspector inspector = application.ActiveInspector();
if (application.ActiveExplorer().Selection[1] is Outlook.MailItem explorerMailItem)
{
// Write code to handle message if sourced from explorer (i.e., Reading Pane)
}
else if (inspector.CurrentItem is Outlook.MailItem inspectorMailItem)
{
// Write code to hanlde message if sourced from inspector
// (i.e., openened (double-clicked) message
}
}
When you double click on email item you open an inspector window and you can access it by using Application.ActiveInspector() method. The Inspector object has CurrentItem property which represents the opened item.
Also, you should avoid using multiple dots in expressions and properly release COM objects.
I am developing one tool to keep track of emails and would like to trace the emails undelivered to sender.
I dont want to use any third party tool or any external reference
What I have tried?
-To read report Item but Body is in Chinese like language
-Googled on some solutions but nothing is working i.e. solution is related to
//PR_TRANSPORT_MESSAGE_HEADERS
link to get property name "http://schemas.microsoft.com/mapi/proptag/0x0C1A001F"
outlook PropertyAccessor class
PropName link is not working anymore.
Could anyone here please help me I would like to get from which sender the email delivery is failed.
Thank you in advance.
The PR_TRANSPORT_MESSAGE_HEADERS property contains the same Diagnostic information shown in the body. You just need to read it using the PropertyAccessor class and parse the string with From and To entries.
Outlook.PropertyAccessor oPA = reportItem.PropertyAccessor;
string transportHeaders = (string)oPA.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x007D001E");
Is it possible to only encrypt mail when its possible.
I wrote an Add-In which auto forward mails. The Add-In stops when it tries to encrypt a mail which cant be ecrypted. For example when there is no public key for the recipient.
I tried to catch and handle throwed exception, but in this case there is no exception thrown. Any ideas?
This is the Method I talk about.
private void signAndEncrypt(Outlook.MailItem mailItem)
{
const string PR_SECURITY_FLAGS = "http://schemas.microsoft.com/mapi/proptag/0x6E010003";
Object ulFlags = 0x3;
mailItem.PropertyAccessor.SetProperty(PR_SECURITY_FLAGS,ulFlags);
}
heres a screenshot of the error. Its in german.
error screenshot
I am working on a WPF application and I wish to open sip:Username#company.com links. I am able to open mailto links using the following code:
private void btnSendEmail_Click(object sender, RoutedEventArgs e)
{
try
{
string mailURL = String.Format("mailto:{0}", UserDetails.EmailAddress);
Process.Start(mailURL);
Close();
}
catch
{
// Handle exception
}
}
Although, I am unable to open sip: links in a similar way. What I am trying to achieve is to open a new chat session with a user, like I am able to do when I follow sip: links from Outlook.
Any ideas?
Edit: I ended up using the CommunicatorAPI. Messenger.InstantMessage() seems to work for me. More info here: http://msdn.microsoft.com/en-us/library/bb787232.aspx
Using Process.Start works fine on my system (with Microsoft Lync 2010, a newer version of Communicator):
void Main()
{
Process.Start("sip:username#company.com");
}
Running the above code results in a new chat window opening. The only exception is when I enter my own user name, in which it starts composing a new Outlook e-mail message to myself. What happens when you use this (maybe also try omitting the following call to Close).
You probably need to associate a program with the "sip" uri scheme. Try this: how do I create my own URL protocol? (e.g. so://...)
if you have Lync or Office Communicator installed, they should respond appropriately to the sip: uri scheme. Also, tel:, callto: etc. For reference, the full list is here.
Is this not working for you from a WPF app? Does it work for you from a basic html page?
I ended up using the CommunicatorAPI. Messenger.InstantMessage() seems to work for me. More info here: http://msdn.microsoft.com/en-us/library/bb787232.aspx
The following code probably didn't work for you because you were trying to IM yourself.
Process.Start("sip:username#company.com");
I'm having problems trying to send an XMPP message to a 'Room' in our OpenFire instance. The end result is for our CruiseControl.NET build server to be able to send success/failure messages to the appropriate 'Rooms' as an additional means of notification.
I'm using the Matrix XMPP library to create a Console Application in C# using VS2010. The idea was to create a simple .exe that I can wire up to CCNet and pass a few arguments into as required.
The code below is basically the sample code from the Matrix site/documentation which I have updated to point to a room.
static void Main(string[] args)
{
var xmppClient = new XmppClient
{
XmppDomain = "SERVER",
Username = "davidc",
Password = "*********"
};
xmppClient.OnRosterEnd += delegate
{
xmppClient.Send(new Message
{
To = "roomname#conference.SERVER",
From = "davidc#SERVER",
Type = MessageType.groupchat,
Body = "Just Testing the XMPP SDK"
});
};
xmppClient.Open();
Console.WriteLine("Press return key to exit the application");
Console.ReadLine();
xmppClient.Close();
}
I can send to an individual user (changing the To and Type accordingly) without any problems but changing the code to point to a room ends in silence! Is there some additional 'handshaking' that needs to be done to address a room?
I don't really have to use C# for the solution as long as it will run on a Windows Server.
You'll want to read XEP-0045, "Multi-User Chat". You need to enter the room before sending a message to it. For a quick fix, see section 7.1.1, which shows how to join a room using a simplified (older) protocol:
<presence
to='darkcave#chat.shakespeare.lit/thirdwitch'/>
For the newer protocol, include an extra x tag from section 7.1.2:
<presence
to='darkcave#chat.shakespeare.lit/thirdwitch'>
<x xmlns='http://jabber.org/protocol/muc'/>
</presence>
I don't know your library, but you'll want code something like:
xmppClient.Send(new Presence
{
To = "roomname#conference.SERVER/mynick",
});