9

I want to invite a user sending a specific message, but I can't find where I can set invitation message.

This is a (simplified) sample of what I do:

skype.Client.Start(true, true);
var user = skype.SearchForUsers("the_name_i_am_searching_for")
    .Cast<User>()
    .FirstOrDefault();
if (user != null)
    user.BuddyStatus = TBuddyStatus.budPendingAuthorization;

With this code default invitation is sent.

Marco
  • 56,740
  • 14
  • 129
  • 152
  • Visit http://stackoverflow.com/questions/3291090/skype-how-to-get-started and find it in the code. – ymd_ Feb 18 '14 at 20:42
  • @YoelMacia: what should I take from that post? I know how to send messages to users and how to ask someone to be a skype friend; what I don't know is how modify the invitation message automatically sent then you do `user.BuddyStatus = TBuddyStatus.budPendingAuthorization`! – Marco Feb 18 '14 at 21:39

2 Answers2

9

Try to use Property array instead of a simple assignment. Change

user.BuddyStatus = TBuddyStatus.budPendingAuthorization;

to

skype.Property["USER", "the_name_i_am_searching_for", "BUDDYSTATUS"] = 
    string.Format("{0} {1}", (int)TBuddyStatus.budPendingAuthorization, 
                             "your welcome message")

I failed to find any official docs, but this lib was very helpful. Notice SetBuddyStatusPendingAuthorization method

Grin
  • 6,082
  • 2
  • 22
  • 15
  • Thanks a lot Grin! Your sample was perfect! – Marco Feb 19 '14 at 06:59
  • Just a note: VS tells you is better using `skype.Property["USER", "the_name_i_am_searching_for", "BUDDYSTATUS"] = string.Format("{0} {1}", (int)TBuddyStatus.budPendingAuthorization, "your welcome message")` – Marco Feb 19 '14 at 07:02
  • @Marco I had to install R# to get this suggestion. Thanks for a note! – Grin Feb 19 '14 at 11:10
1

The skype API offers a function skype.SendMessage(<username>, <string>) which I think is what you are looking for.

Pandrei
  • 4,843
  • 3
  • 27
  • 44
  • No, `SendMessage` is used to send a message to a user. Unfortunately it's not the message you send when you invite a user to become your friend... – Marco Feb 18 '14 at 15:06