14

Possible Duplicate:
Skype Addon in C#

How can I implement the Skype API to access user information in C#?

Community
  • 1
  • 1

4 Answers4

24

UPDATE: Unfortunately, the documentation is no longer available. There is a chance though, that the below code still works, but afaik Microsoft has long planned to remove support for COM automation from Skype.


It is probably easiest to download and install the Skype API COM Wrapper.

Then you can simply add a reference to this wrapper from the COM tab of the Add References dialog in your Visual Studio project.

Below is a short sample program illustrating how to search for a user and how to send a message:

using System;
using SKYPE4COMLib;

class Program
{
    static void Main(string[] args)
    {
        Skype skype = new Skype();
        if (!skype.Client.IsRunning)
        {
            // start minimized with no splash screen
            skype.Client.Start(true, true);
        }

        // wait for the client to be connected and ready
        skype.Attach(6, true);

        // access skype objects
        Console.WriteLine("Missed message count: {0}", skype.MissedMessages.Count);

        // do some stuff
        Console.WriteLine("Enter a skype name to search for: ");
        string username = Console.ReadLine();
        foreach (User user in skype.SearchForUsers(username))
        {
            Console.WriteLine(user.FullName);
        }

        Console.WriteLine("Say hello to: ");
        username = Console.ReadLine();
        skype.SendMessage(username, "Hello World");
    }
}
Dirk Vollmar
  • 172,527
  • 53
  • 255
  • 316
  • Is it so easy to use Skype API? `COM Wrapper` link does not work. Is the only thing you have to download? – giannis christofakis Nov 20 '12 at 17:00
  • 1
    @yannishristofakis: I updated the link. Make sure to checkout the developer documentation at https://developer.skype.com/ as well, it contains plenty of useful information and samples. – Dirk Vollmar Nov 21 '12 at 09:18
  • Thanks for updating the link.Great code sample for someone to start of.Do you know any alternative information source? – giannis christofakis Nov 21 '12 at 16:07
  • works for new version skype - msn ? – Kiquenet Jun 25 '13 at 20:58
  • Superb that's amazing. You not only saved my day in-fact you saved my DAYS :) – Mehmood Oct 28 '14 at 13:46
  • the link seems to be broke again. :( – Jack Dec 17 '14 at 22:54
  • I just downloaded the libery at https://skype.codeplex.com/releases/view/21482 – Jack Dec 17 '14 at 23:19
  • @DirkVollmar-0xA3: Any documentation available about the library? – Jack Dec 18 '14 at 00:42
  • @Jack: Unfortunately, the documentation is no longer available. There is a chance though, that the above code still works, but afaik Microsoft has long planned to remove support for COM automation from Skype. – Dirk Vollmar Dec 18 '14 at 07:59
  • @DirkVollmar-0xA3: Any idea why is Microsoft going to remove support for COM automation? :( this code still works but I'd like to know more. on VS' intellisense there are no description about the method. I can suppose what will do only by name. Can I for example, intercept a new message, replace some contents on it and then send it? – Jack Feb 01 '15 at 17:47
5

Just to point out here. After downloading the Skype4COM.dll you will probably need to use regsvr32 to register the dll, that way inside Visual Studio you can add the .dll as a recognised COM Component!

regsvr32 C:\Windows\System32\Skype4COM.dll

for example, you will get a popup indicating it successfully registered it, and now back in your IDE, inside the Add Reference under the COM Tab you will see the Skype Library.

Hope this helps,

Andrew

Rui Jarimba
  • 11,166
  • 11
  • 56
  • 86
REA_ANDREW
  • 10,666
  • 8
  • 48
  • 71
4

The main skype download site is no longer live, here is a mirror:

https://sites.google.com/site/appanalyzecomponent/skype4com

Dan
  • 41
  • 1
3

If you means to access status of particular user from ASP.NET.

so, you want to know if that person is available or not. add image link to this url.

<img src="http://mystatus.skype.com/smallclassic/skypename" />

Where skyname is the person that you want to show status.

To make a link for Skype's profile

<a href="skype:skypename?userinfo">Joe Doe's Profile</a>

but if you want to do it other way e.g. Code-Behind - Then this link should provide all example you need - https://developer.skype.com/Docs/Skype4COM/Example?action=show

IUserCollection iusercollection = skype.SearchForUsers("echo123");
if (iusercollection.Count > 0)
{
    Console.WriteLine(iusercollection[0].FullName);
}

List of all IUser interface can find at https://developer.skype.com/Docs/Skype4COMLib/IUser

Hope this helps

Jirapong
  • 24,074
  • 10
  • 54
  • 72