Lync:CanInvoke在下载附件时返回false

时间:2014-04-12 18:28:14

标签: lync lync-2013 lync-client-sdk

我有代码将文件发送到客户端&另一方面,我正在使用ContentAdded事件接收它。该事件被引发但CanInvoke返回false。哪里出错了?

void _sharingModality_ContentAdded(object sender, ContentCollectionChangedEventArgs e)
    {
        if (e.Item.Type == ShareableContentType.NativeFile)
        {
            int hr;
            if (e.Item.CanInvoke(ShareableContentAction.DownloadFile, out hr))
            {
                MessageBox.Show("download event raised");
            }
            else
            {
                MessageBox.Show("u cannot invoke download");
            }
        }
    }

谢谢!

(注意:我正在使用Lync客户端2013)

编辑1:

如果我在该语句之前放置一个消息框,则CanInvoke返回true,否则返回false。它会影响一些后台线程吗?

1 个答案:

答案 0 :(得分:1)

得到了答案。当我在其上触发CanInvoke时,我们文件的ShareableContent状态为Connecting。只有在状态更改为Online时才能下载该文件。因此,通过处理ShareableContent.StateChanged事件,我使其成功。如此简单,但由于文档很差,花了很多时间。

MSDN reference here..

相关问题