vb.netskypeskype4comskypedeveloper

How to auto accept Skype friend requests in VB.NET using Skype4COMLib?


Hello everyone so I'm trying to auto accept friend requests on my Skype using VB.NET and Skype4COMLib but I'm getting this error:

Private Sub oskype_userauthorizationrequestreceived(pUser As SKYPE4COMLib.User)' cannot handle event 'Public Event UserAuthorizationRequestReceived(sender As Object, e As AxSKYPE4COMLib._ISkypeEvents_UserAuthorizationRequestReceivedEvent)' because they do not have a compatible signature.

The code:

 Private Sub oskype_userauthorizationrequestreceived(pUser As User) Handles oSkype.UserAuthorizationRequestReceive 
    If MaterialCheckBox7.Checked = True And pUser.IsAuthorized = False Then
        pUser.IsAuthorized = True
    End If
End Sub

I can't get it solved, I want it to accept friend requests whenever I click my checkbox and disable the auto accept requests whenever I deselect the checkbox.

Any help is appreciated, thank you.


Solution

  • Sorry for this late reply, but the error message is actually very clear.

    Your event subscription currently looks like this:

    Private Sub oskype_userauthorizationrequestreceived(pUser As SKYPE4COMLib.User) Handles oSkype.UserAuthorizationRequestReceive
    

    But the Skype4Com library's event is declared like this:

    Public Event UserAuthorizationRequestReceived(sender As Object, e As AxSKYPE4COMLib._ISkypeEvents_UserAuthorizationRequestReceivedEvent)
    

    As you might see you are missing one argument, and the second argument is of the wrong type.

    The fix is simply changing the arguments to match the event:

    Private Sub oskype_userauthorizationrequestreceived(sender As Object, e As AxSKYPE4COMLib._ISkypeEvents_UserAuthorizationRequestReceivedEvent) Handles oSkype.UserAuthorizationRequestReceive
    

    I'd guess that you can extract the specific user if you look through the properties of the e argument.