示例#1
0
        private void btTest_Click(object sender, EventArgs e)
        {
            System.Security.Principal.WindowsIdentity id = System.Security.Principal.WindowsIdentity.GetCurrent();
            String strDesKey = Globals.ThisAddIn.Application.Session.CurrentUser.AddressEntry.GetExchangeUser().PrimarySmtpAddress.Substring(0, 8);

            ShareFileSelectDialog dlg = new ShareFileSelectDialog();

            dlg.Show();
        }
示例#2
0
        private void btSelectShareFile_Click(object sender, EventArgs e)
        {
            String strSelectedFile = String.Empty;

            ShareFileSelectDialog dlgFileSelect = new ShareFileSelectDialog();

            if (dlgFileSelect.ShowDialog() == DialogResult.OK)
            {
                strSelectedFile = dlgFileSelect.strSelectedFile;
            }
            else
            {
                //MessageBox.Show("读取网盘数据失败!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            String[] strArrSelectedFile = strSelectedFile.Split(';');

            if (!SeafileLogon())
            {
                LogTrace.TraceError("Fileshare logon failed.");
                return;
            }

            foreach (String strFile in strArrSelectedFile)
            {
                String strDownloadLink = httpClient.ExecuteCreateSeaFileCreateDownloadLinkRequest(m_strToken, m_strRepoID, strFile, Globals.ThisAddIn.GetShareFilePassword(), Globals.ThisAddIn.GetExpireDates());
                String strFileName     = strFile.Substring(strFile.LastIndexOf("/"));

                if (strDownloadLink != null && strDownloadLink != "" && strDownloadLink != string.Empty)
                {
                    ReplceAttachment(strFileName, strDownloadLink);

                    LogTrace.TraceInfo("Fileshare replace file {0} with Link {1} Expire time {2}", strFileName, strDownloadLink, Globals.ThisAddIn.GetExpireDates());
                }
                else
                {
                    MessageBox.Show("文件(" + strFileName + ")下载链接获取失败");
                    LogTrace.TraceError("Retrieve file {0} download link failed", strFileName);
                }
            }
        }