File UCMA发送文件&;文件传输示例

File UCMA发送文件&;文件传输示例,file,api,transfer,lync,ucma,File,Api,Transfer,Lync,Ucma,没有用于UCMA将文件从applicationendpoint发送到userendpoint或从applicationendpoint发送到userendpoint的示例 我试过下面的示例,但不起作用。请参阅代码和错误: if (e.State == MediaFlowState.Active) { byte[] fileBytes = null; using (FileStream fs = File.OpenRe

没有用于UCMA将文件从applicationendpoint发送到userendpoint或从applicationendpoint发送到userendpoint的示例

我试过下面的示例,但不起作用。请参阅代码和错误:

        if (e.State == MediaFlowState.Active)
        {
            byte[] fileBytes = null;
            using (FileStream fs = File.OpenRead(_fileToSend))
            {
                fileBytes = new byte[fs.Length];
                fs.Read(fileBytes, 0, fileBytes.Length);
            }

            ContentType ct = new ContentType("text/x-msmsgsinvite");
            ct.CharSet = "UTF-8";
            StringBuilder sb = new StringBuilder();
            sb.Append("Application-Name: File Transfer\r\n");
            sb.Append("Application-GUID: {5D3E02AB-6190-11d3-BBBB-00C04F795683}\r\n");
            sb.Append("Invitation-Command: INVITE\r\n");
            sb.Append("Invitation-Cookie: 33267\r\n");
            sb.Append("Application-File: Readme.txt\r\n");
            sb.Append("Application-FileSize: " + fileBytes.Length.ToString() + "\r\n");
            sb.Append("Connectivity: N\r\n\r\n");
            string s = sb.ToString();
            byte[] bytes1 = Encoding.UTF8.GetBytes(s);

            try
            {
                _instantMessagingFlow.BeginSendInstantMessage(ct, bytes1, result1 =>
                {
                    _instantMessagingFlow.EndSendInstantMessage(result1);
                }, null);

                WriteLog.AddLine("File sent to: " + _coachSipAddress + " from: " + _userSipAddress + " the file: " + _fileToSend);
            }
            catch (Exception ex)
            {
                WriteLog.AddLine("File couldn't sent " + ex.StackTrace);
            }
        }
11:16小酌:emre@dev-adoptuc.com说:邀请命令:取消 邀请Cookie:33267取消代码:失败


是否有人可以帮助或提供任何示例,以便在UCMA中发送文件以进行文件传输?

看起来邀请未被接受,您能否确认您正在对Flow进行回调。BeginSendInstantMessage()?我接受了邀请,但收到了此错误。@kdrlzmlr我还试图用UCMA发送文件。你解决了这个问题吗?@meir是的,我解决了。请按照本网站的说明进行操作。