how to get some message before transfer a file
-
Wednesday, April 25, 2012 6:49 AM
hi, i use some code to get something when others participants sending message
it's code:
var imModality = (Microsoft.Lync.Model.Conversation.InstantMessageModality)t.Modalities[ModalityTypes.InstantMessage];
imModality.InstantMessageReceived += new EventHandler<MessageSentEventArgs>(imModality_InstantMessageReceived);in imModality_InstantMessageReceived,i can get something message ,such as ParticipantProperty.Name and do i want something.
but when other participants transfer a file ,imModality_InstantMessageReceived No effect,how to get some message before transfer a file ,or how can i Monitor before transfer a file,so that i can do something
some body have any idea?
All Replies
-
Friday, May 04, 2012 12:28 PMYou could receive the message on other event handler related to the modality
-
Friday, May 04, 2012 7:25 PM
Lync 2010 SDK supports sending File Transfer through the APIs but not accepting it through the APIs. Receiving client has to be a Lync UI user and accept it in the CW.
Here is the code for sending file transfer
Automation _Automation = LyncClient.GetAutomation(); // Create a dictionary object to contain AutomationModalitySettings data pairs. Dictionary<AutomationModalitySettings, object> _ModalitySettings = new Dictionary<AutomationModalitySettings, object>(); AutomationModalities _ChosenMode = AutomationModalities.FileTransfer | AutomationModalities.InstantMessage; // Store the file path as an object using the generic List class. string myFileTransferPath = string.Empty; // Edit this to provide a valid file path. myFileTransferPath = System.IO.Path.GetFullPath(textBoxFilePath.Text.Trim()); // Create a generic List object to contain a contact URI. String[] invitees = { textBoxTo.Text.Trim() }; // Adds text to toast and local user IMWindow text entry control. _ModalitySettings.Add(AutomationModalitySettings.FirstInstantMessage, "Sending a file."); _ModalitySettings.Add(AutomationModalitySettings.SendFirstInstantMessageImmediately, true); // Add file transfer conversation context type _ModalitySettings.Add(AutomationModalitySettings.FilePathToTransfer, myFileTransferPath); // Start the conversation. IAsyncResult ar = _Automation.BeginStartConversation( _ChosenMode , invitees , _ModalitySettings , null , null); // Block UI thread until conversation is started. _Automation.EndStartConversation(ar);Lync SDK Team - This posting is provided "AS IS" with no warranties, and confers no rights.
- Proposed As Answer by Kai Strandskov [Msft]Owner Monday, May 07, 2012 8:18 PM
- Marked As Answer by Kai Strandskov [Msft]Owner Tuesday, May 08, 2012 8:13 PM
-
Thursday, August 23, 2012 9:15 AM
Hello,
so there is no way i could catch the event, that somebody is sending me a file? I do not want to receive it over API, i just want a notification that someone is sending me a file.
With InstantMessageReceived event i get the notification that somebody is sending me a text, and then i make my application blinking to notify the user.
The same i would like to do, when somebody is sending me a file to transfer. Is this possible?Thanks for all your help!
Best regards, Peter Korosec

