PeerCollabInviteContact function (p2p.h)
The PeerCollabInviteContact function sends an invitation to join a peer collaboration activity to a trusted contact. This call is synchronous and, if successful, obtains a response from the contact.
Syntax
NOT_BUILD_WINDOWS_DEPRECATE HRESULT PeerCollabInviteContact(
[in] PCPEER_CONTACT pcContact,
[in] PCPEER_ENDPOINT pcEndpoint,
[in] PCPEER_INVITATION pcInvitation,
[out] PPEER_INVITATION_RESPONSE *ppResponse
);
Parameters
[in] pcContact
Pointer to a PEER_CONTACT structure that contains the contact information associated with the invitee.
[in] pcEndpoint
Pointer to a PEER_ENDPOINT structure that contains information about the invited peer. This peer is sent an invitation when this API is called.
[in] pcInvitation
Pointer to a PEER_INVITATION structure that contains the invitation request to send to the endpoint(s) specified in pcEndpoint. This parameter must not be set to NULL.
[out] ppResponse
Pointer to a PEER_INVITATION_RESPONSE structure that receives an invited peer endpoint's responses to the invitation request.
If this call fails with an error, this parameter will be NULL.
Free the memory returned by calling PeerFreeData.
Return value
Returns S_OK if the function succeeds. Otherwise, the function returns one of the following values.
Return code | Description |
---|---|
|
There is not enough memory to support this operation. |
|
One of the arguments is invalid. |
|
The recipient of the invitation has not responded within 5 minutes. |
Remarks
This API ensures the peer that receives the invitation is the contact specified as input. The connection will fail if the specific contact is not present on the endpoint specified. The use of PeerCollabInviteContact is recommended in place of the less secure PeerCollabInviteEndpoint.
A toast will appear for the recipient of the invitation. This toast will be converted to a dialog box in which the user can accept or decline the invitation. When the invitation is successfully accepted, the collaborative application is launched on the recipient's machine.
To successfully receive the invitation, the application must be registered on the recipient's machine using PeerCollabRegisterApplication. It is also possible for the sender of the invite to have failure codes returned because the recipient has turned off application invites.
If the recipient is accepting invitations only from trusted contacts, then the sender of the invite must be added to the contact store of the recipient machine. The sender must be added to the contact store before the invitation attempt. To add a contact to the contact store, call PeerCollabAddContact.
The recipient of the invitation must respond within 5 minutes to avoid timeout.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows Vista [desktop apps only] |
Minimum supported server | None supported |
Target Platform | Windows |
Header | p2p.h |
Library | P2P.lib |
DLL | P2P.dll |