/// <summary>
        /// 召集或预约非周期性会议
        /// </summary>
        /// <param name="scheduleConf">
        /// 准备预约的会议参数,包含会场列表和参数,预约时 ConferenceInfoEx 必填参数包括:
        /// name:会议名称
        /// string:会议开始时间
        /// rate:速率
        /// duration:会议时长
        /// sites:会场信息列表
        /// 其中会场列表参数中的 SiteInfoEx 必填参数为:
        /// uri 会场标识。当 uri 为空时,预约匿名会议。
        ///</param>
        /// <returns>操作成功则 response.result返回预约成功后会议基本信息,包括系统分配的会议 ID,会议的接入码等信息。</returns>
        public TPOASDKResponse<ConferenceInfo> scheduleConf(ConferenceInfo scheduleConf)
        {
            TPOASDKResponse<ConferenceInfo> resp = new TPOASDKResponse<ConferenceInfo>();
            TPProfessionalConfMgrService confMgr = new TPProfessionalConfMgrService(appSetting);
            //UtilsSettings appSetting = new UtilsSettings();
            confMgr.Header = appSetting.Header;
            try
            {
                //rsa = new RSA2048(platformKeyURL);

                if (null != scheduleConf.auxVideoFormat)
                {
                    scheduleConf.auxVideoFormatSpecified = true;
                }
                if (null != scheduleConf.auxVideoProtocol)
                {
                    scheduleConf.auxVideoProtocolSpecified = true;
                }
                if (null != scheduleConf.isRecording)
                {
                    scheduleConf.isRecordingSpecified = true;
                }
                if (null != scheduleConf.isLiveBroadcast)
                {
                    scheduleConf.isLiveBroadcastSpecified = true;
                }
                if (null != scheduleConf.status)
                {
                    scheduleConf.statusSpecified = true;
                }

                for(int i = 0;i<scheduleConf.sites.Length;i++)
                {
                    if (scheduleConf.sites[i].videoFormat != null)
                    {
                        scheduleConf.sites[i].videoFormatSpecified = true;
                    }
                    if (scheduleConf.sites[i].videoProtocol != null)
                    {
                        scheduleConf.sites[i].videoProtocolSpecified = true;
                    }
                    if (scheduleConf.sites[i].status != null)
                    {
                        scheduleConf.sites[i].statusSpecified = true;
                    }
                }

                //if (scheduleConf.password != null && scheduleConf.password != "")
                //{
                //    scheduleConf.password = rsa.RSAEncrypt(scheduleConf.password);
                //}
                //if (scheduleConf.chairmanPassword != null && scheduleConf.chairmanPassword != "")
                //{
                //    scheduleConf.chairmanPassword = rsa.RSAEncrypt(scheduleConf.chairmanPassword);
                //}
                int resultCode;
                ConferenceInfo conferenceInfoEx;

                resultCode = confMgr.scheduleConf(scheduleConf, out conferenceInfoEx);

                resp.resultCode = resultCode;
                resp.result = 0 == resultCode ? conferenceInfoEx : null;
                return resp;
            }
            catch (SoapHeaderException e)
            {
                int errorCode = ExceptionUtils.processSoapException(e);
                resp.resultCode = errorCode;
                return resp;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 从约会界面,获取非周期性会议信息
        /// </summary>
        /// <param name="ConfInfo">非周期性会议信息</param>
        private void setConferenceInfo(ref ConferenceInfo ConfInfo, AppointmentItem tempAppt)
        {
            ThisAddIn.g_log.Info("setConferenceInfo begin");
            ConfInfo.name = tempAppt.Subject;
            ConfInfo.beginTime = tempAppt.Start.ToUniversalTime();

            TimeSpan span = tempAppt.End - tempAppt.Start;
            string duration = String.Format("P0Y0M{0}DT{1}H{2}M{3}S", span.Days, span.Hours, span.Minutes, span.Seconds);
            ConfInfo.duration = duration;

            ConfInfo.rate = ThisAddIn.g_SystemSettings.strSiteRate;
            ConfInfo.mediaEncryptType = ThisAddIn.g_SystemSettings.nMediaEncryptType;
            ConfInfo.isRecording = ThisAddIn.g_SystemSettings.nRecording;

            ConfInfo.isLiveBroadcast = ThisAddIn.g_SystemSettings.nLiving;
            ConfInfo.billCode = ThisAddIn.g_SystemSettings.strBillCode;
            ConfInfo.password = ThisAddIn.g_SystemSettings.strConfPWD;
            ConfInfo.chairmanPassword = ThisAddIn.g_SystemSettings.strConfPWD;
            ConfInfo.cpResouce = ThisAddIn.g_SystemSettings.nCPResource;

            GetUserProperties(ref ConfInfo, tempAppt);
            ThisAddIn.g_log.Info(string.Format("conf name is: {0}", ConfInfo.name));
            ThisAddIn.g_log.Info(string.Format("conf begin at: {0}", ConfInfo.beginTime));
            ThisAddIn.g_log.Info(string.Format("conf duration: {0}", ConfInfo.duration));
            ThisAddIn.g_log.Info(string.Format("conf rate is: {0}", ConfInfo.rate));
            ThisAddIn.g_log.Info(string.Format("conf media encrypt type is: {0}", ConfInfo.mediaEncryptType));
            ThisAddIn.g_log.Info(string.Format("conf recording is: {0}", ConfInfo.isRecording));

            ThisAddIn.g_log.Info(string.Format("conf living is: {0}", ConfInfo.isLiveBroadcast));
            ThisAddIn.g_log.Info(string.Format("conf bill code is: {0}", ConfInfo.billCode));
            ThisAddIn.g_log.Info(string.Format("conf password is: ******"));
            ThisAddIn.g_log.Info(string.Format("conf chairman password is: ******"));
            ThisAddIn.g_log.Info(string.Format("conf CPResource is: {0}", ConfInfo.cpResouce));
            // 0:无效类型
            // 1:根据会场标识自动从系统获取(保留)
            // 2:E1 类型会场
            // 3:ISDN 类型会场
            // 4:H.323 类型会场
            // 5:PSTN 类型会场
            // 6:4E1 类型会场
            // 7:SIP 类型会场
            // 8:VoIP SIP 类型会场
            // 9:VoIP H.323 类型会场

            //视频会场
            ArrayList list = new ArrayList();
            SiteInfo tempSite = null;
            int nVideoCount = 0;
            UserProperty up = tempAppt.UserProperties.Find(PROPERTY_VIDEO_SITES_COUNT, Type.Missing);
            if (up != null)
            {
                nVideoCount = up.Value;
            }
            else
            {
                nVideoCount = ThisAddIn.g_SystemSettings.nVideoSitesCount;
            }

            if (nVideoCount > 0)
            {
                for (int i = 0; i < nVideoCount; i++)
                {
                    tempSite = new SiteInfo();
                    tempSite.type = 4;
                    list.Add(tempSite);
                }
            }
            ThisAddIn.g_log.Info(string.Format("video site count is: {0}", nVideoCount));

            //语音会场
            int nVoiceCount = 0;
            up = tempAppt.UserProperties.Find(PROPERTY_VOICE_SITES_COUNT, Type.Missing);
            if (up != null)
            {
                nVoiceCount = up.Value;
            }
            else
            {
                nVoiceCount = ThisAddIn.g_SystemSettings.nVoiceSitesCount;
            }

            if (nVoiceCount > 0)
            {
                for (int i = 0; i < nVoiceCount; i++)
                {
                    tempSite = new SiteInfo();
                    tempSite.type = 9;
                    list.Add(tempSite);
                }
            }
            ThisAddIn.g_log.Info(string.Format("voice site count is: {0}", nVoiceCount));

            //2015-7-8 w00322557 临时会场
            up = tempAppt.UserProperties.Find(PROPERTY_TEMP_SITES, Type.Missing);
            if (up != null)
            {
                List<SiteInfo> listTempSites = XmlHelper.Desrialize<List<SiteInfo>>(up.Value);
                foreach (SiteInfo site in listTempSites)
                {
                    list.Add(site);
                    ThisAddIn.g_log.Info(string.Format("Temp site name: {0}", site.name));
                    ThisAddIn.g_log.Info(string.Format("Temp site uri: {0}", site.uri));
                    ThisAddIn.g_log.Info(string.Format("Temp site type: {0}", site.type));
                }
            }
            else
            {
                ThisAddIn.g_log.Debug("Temp site is null or empty!");
            }

            //从地址栏获取智真会场
            List<string> listSites = GetTPSitesFromLocation(tempAppt);

            if (listSites != null)
            {
                SiteInfo[] sites = new SiteInfo[listSites.Count];
                for (int i = 0; i < listSites.Count; i++)
                {
                    sites[i] = new SiteInfo();
                    sites[i].uri = listSites[i];
                    sites[i].type = -1;
                    list.Add(sites[i]);

                    ThisAddIn.g_log.Info(string.Format("TP site uri is: {0}", sites[i].uri));
                }
            }

            if (list.Count > 0)
            {
                ConfInfo.sites = (SiteInfo[])list.ToArray(typeof(SiteInfo));
                ThisAddIn.g_log.Info(string.Format("ConfInfo sites count is: {0}", ConfInfo.sites.Length));
                ThisAddIn.g_log.Info(string.Format("Total TP sites count is: {0}", list.Count));
            }
            else
            {
                ThisAddIn.g_log.Error(string.Format("There is no TP sites!"));
            }

            ThisAddIn.g_log.Info("setConferenceInfo end");
        }
Exemplo n.º 3
0
        /// <summary>
        /// 保存用户自定义属性
        /// </summary>
        /// <param name="confInfo"></param>
        /// <param name="ai"></param>
        public static void SaveReturnUserProperties(ConferenceInfo confInfo, AppointmentItem ai)
        {
            ThisAddIn.g_log.Info(string.Format("SaveReturnUserProperties begin"));
            try
            {
                ThisAddIn.g_log.Info(string.Format("return conf name is: {0}", confInfo.name));
                ThisAddIn.g_log.Info(string.Format("return conf beginTime is: {0}", confInfo.beginTime.ToLocalTime().ToLongTimeString()));
                ThisAddIn.g_log.Info(string.Format("return conf duration is: {0}", confInfo.duration));
                ThisAddIn.g_log.Info(string.Format("return conf rate is: {0}", confInfo.rate));

                ThisAddIn.g_log.Info(string.Format("return conf isRecording is: {0}", confInfo.isRecording));

                foreach(SiteInfo site in confInfo.sites)
                {
                    ThisAddIn.g_log.Info(string.Format("return conf site name is: {0}",site.name));
                    ThisAddIn.g_log.Info(string.Format("return conf site uri is: {0}", site.uri));
                    ThisAddIn.g_log.Info(string.Format("return conf site type is: {0}", site.type));
                }

                //confId
                UserProperty upConfoID = ai.UserProperties.Add(PROPERTY_NAME_CONF_INFO, Outlook.OlUserPropertyType.olText, Type.Missing, Type.Missing);
                upConfoID.Value = confInfo.confId;
                ThisAddIn.g_log.Info(string.Format("return conf id is: {0}", confInfo.confId));

                //access code
                UserProperty upAccessCode = ai.UserProperties.Add(PROPERTY_ACCESS_CODE, Outlook.OlUserPropertyType.olText, Type.Missing, Type.Missing);
                upAccessCode.Value = confInfo.accessCode;
                ThisAddIn.g_log.Info(string.Format("return conf access code is: {0}", confInfo.accessCode));

                //recording address
                UserProperty upRecordingAddress = ai.UserProperties.Add(PROPERTY_RECORDING_ADDRESS, Outlook.OlUserPropertyType.olText, Type.Missing, Type.Missing);
                upRecordingAddress.Value = confInfo.recorderAddr;
                ThisAddIn.g_log.Info(string.Format("return conf recorder url is: {0}", confInfo.recorderAddr));
            }
            catch (System.Exception ex)
            {
                ThisAddIn.g_log.Error(string.Format("SaveReturnUserProperties exception,{0}", ex.Message));
                MessageBox.Show(ex.Message);
            }
            ThisAddIn.g_log.Info(string.Format("SaveReturnUserProperties end"));
        }
Exemplo n.º 4
0
        /// <summary>
        /// 获取用户自定义属性
        /// </summary>
        /// <param name="confInfo"></param>
        /// <param name="ai"></param>
        public static void GetUserProperties(ref ConferenceInfo confInfo, AppointmentItem ai)
        {
            UserProperty up = ai.UserProperties.Find(PROPERTY_NAME_CONF_INFO, Type.Missing);
            if (up != null)
            {
                confInfo.confId = up.Value;
            }
            else
            {
                UserProperty upConfoID = ai.UserProperties.Add(ThisAddIn.PROPERTY_NAME_CONF_INFO, Outlook.OlUserPropertyType.olText, Type.Missing, Type.Missing);
            }

            up = ai.UserProperties.Find(PROPERTY_CONFERENCE_PASSWORD, Type.Missing);
            if (up != null)
            {
                confInfo.password = up.Value;
                confInfo.chairmanPassword = up.Value;
            }
            else
            {
                UserProperty upConfoPassword = ai.UserProperties.Add(ThisAddIn.PROPERTY_CONFERENCE_PASSWORD, Outlook.OlUserPropertyType.olText, Type.Missing, Type.Missing);
                upConfoPassword.Value = ThisAddIn.g_SystemSettings.strConfPWD;
            }

            up = ai.UserProperties.Find(PROPERTY_VIDEO_SITES_COUNT, Type.Missing);
            if (up != null)
            {

            }
            else
            {
                UserProperty upVideoSiteCounts = ai.UserProperties.Add(ThisAddIn.PROPERTY_VIDEO_SITES_COUNT, Outlook.OlUserPropertyType.olInteger, Type.Missing, Type.Missing);
                upVideoSiteCounts.Value = ThisAddIn.g_SystemSettings.nVideoSitesCount;
            }

            up = ai.UserProperties.Find(PROPERTY_VOICE_SITES_COUNT, Type.Missing);
            if (up != null)
            {

            }
            else
            {
                UserProperty upVoiceSiteCounts = ai.UserProperties.Add(ThisAddIn.PROPERTY_VOICE_SITES_COUNT, Outlook.OlUserPropertyType.olInteger, Type.Missing, Type.Missing);
                upVoiceSiteCounts.Value = ThisAddIn.g_SystemSettings.nVoiceSitesCount;
            }

            up = ai.UserProperties.Find(PROPERTY_IS_RECORDING, Type.Missing);
            if (up != null)
            {
                confInfo.isRecording = Convert.ToInt32(up.Value);
            }
            else
            {
                UserProperty upRecording = ai.UserProperties.Add(ThisAddIn.PROPERTY_IS_RECORDING, Outlook.OlUserPropertyType.olYesNo, Type.Missing, Type.Missing);
                upRecording.Value = Convert.ToBoolean(ThisAddIn.g_SystemSettings.nRecording);
            }

            up = ai.UserProperties.Find(PROPERTY_IS_LIVING, Type.Missing);
            if (up != null)
            {
                confInfo.isLiveBroadcast = Convert.ToInt32(up.Value);
            }
            else
            {
                UserProperty upLiving = ai.UserProperties.Add(ThisAddIn.PROPERTY_IS_LIVING, Outlook.OlUserPropertyType.olYesNo, Type.Missing, Type.Missing);
                upLiving.Value = Convert.ToBoolean(ThisAddIn.g_SystemSettings.nLiving);
            }

            up = ai.UserProperties.Find(PROPERTY_SITE_RATE, Type.Missing);
            if (up != null)
            {
                confInfo.rate = up.Value;
            }
            else
            {
                UserProperty upSiteRate = ai.UserProperties.Add(ThisAddIn.PROPERTY_SITE_RATE, Outlook.OlUserPropertyType.olText, Type.Missing, Type.Missing);
                upSiteRate.Value = ThisAddIn.g_SystemSettings.strSiteRate;
            }

            up = ai.UserProperties.Find(PROPERTY_SECURITY_LEVEL, Type.Missing);
            if (up != null)
            {
                confInfo.mediaEncryptType = up.Value;
            }
            else
            {
                UserProperty upSecurityLevel = ai.UserProperties.Add(ThisAddIn.PROPERTY_SECURITY_LEVEL, Outlook.OlUserPropertyType.olInteger, Type.Missing, Type.Missing);
                upSecurityLevel.Value = ThisAddIn.g_SystemSettings.nMediaEncryptType;
            }

            up = ai.UserProperties.Find(PROPERTY_BILL_CODE, Type.Missing);
            if (up != null)
            {
                confInfo.billCode = up.Value;
            }
            else
            {
                UserProperty upBillCode = ai.UserProperties.Add(ThisAddIn.PROPERTY_BILL_CODE, Outlook.OlUserPropertyType.olText, Type.Missing, Type.Missing);
                upBillCode.Value = ThisAddIn.g_SystemSettings.strBillCode;
            }

            up = ai.UserProperties.Find(PROPERTY_CPRESOURCE, Type.Missing);
            if (up != null)
            {
                if (false == ThisAddIn.g_SystemSettings.bShowCPResource)
                {
                    confInfo.cpResouce = 0;
                }
                else
                {
                    confInfo.cpResouce = up.Value;
                }
            }
            else
            {
                UserProperty upCPResource = ai.UserProperties.Add(ThisAddIn.PROPERTY_CPRESOURCE, Outlook.OlUserPropertyType.olInteger, Type.Missing, Type.Missing);

                if (false == ThisAddIn.g_SystemSettings.bShowCPResource)
                {
                    upCPResource.Value = 0;
                    confInfo.cpResouce = 0;
                }
                else
                {
                    upCPResource.Value = ThisAddIn.g_SystemSettings.nCPResource;
                }
            }

            //2015-7-8 w00322557
            up = ai.UserProperties.Find(PROPERTY_TEMP_SITES, Type.Missing);
            List<SiteInfo> listSites = new List<SiteInfo>();
            if (up != null)
            {
                listSites = XmlHelper.Desrialize<List<SiteInfo>>(up.Value);
            }
            else
            {
                UserProperty upTempSites = ai.UserProperties.Add(ThisAddIn.PROPERTY_TEMP_SITES, Outlook.OlUserPropertyType.olText, Type.Missing, Type.Missing);
                upTempSites.Value = XmlHelper.Serialize(listSites);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 预约非周期性智真会议
        /// </summary>
        /// <returns>native接口返回值</returns>
        private int scheduleTPConf(AppointmentItem ai)
        {
            ThisAddIn.g_log.Info("scheduleTPConf enter");
            //2014-4-29
            Inspector ins = ai.GetInspector;

            ConferenceInfo ConfInfo = new ConferenceInfo();
            setConferenceInfo(ref ConfInfo, ai);

            //2015-5-25 w00322557 账号传入“eSDK账号,Outlook邮箱账号”
            Outlook.ExchangeUser mainUser = Globals.ThisAddIn.Application.Session.CurrentUser.AddressEntry.GetExchangeUser();
            string strOutlookAccount = string.Empty;
            if (mainUser != null)
            {
                strOutlookAccount = mainUser.PrimarySmtpAddress;
            }

            string strAccountName = string.Format("{0},{1}", ThisAddIn.g_AccountInfo.strUserName, strOutlookAccount);
            string strAccountPWD = ThisAddIn.g_AccountInfo.strPWD;
            string strServerAddress = ThisAddIn.g_AccountInfo.strServer;

            ThisAddIn.g_log.Debug(string.Format("Account is: {0}", strAccountName));
            ThisAddIn.g_log.Debug("PWD is: ******");
            ThisAddIn.g_log.Debug(string.Format("Server is: {0}", strServerAddress));

            TPOASDKResponse<ConferenceInfo> response = null;
            try
            {
                //密码不存在,返回
                if (string.IsNullOrEmpty(ThisAddIn.g_AccountInfo.strPWD))
                {
                    ThisAddIn.g_log.Info("pwd is null");
                    MessageBox.Show(GlobalResourceClass.getMsg("INPUT_OUTLOOK_PASSWORD"));
                }

                ConferenceMgrService conferenceServiceEx = ConferenceMgrService.Instance(strAccountName, strAccountPWD, strServerAddress);
                response = conferenceServiceEx.scheduleConf(ConfInfo);
                ThisAddIn.g_log.Info(string.Format("scheduleConf return: {0}", response.resultCode));
            }
            catch (System.Exception ex)
            {
                ThisAddIn.g_log.Error(string.Format("scheduleConf exception:{0}", ex.Message));
                return PARAM_ERROR;
            }

            if (0 == response.resultCode)
            {
                //预约成功,将返回的confId作为属性保存
                ConferenceInfo retConfInfo = response.result;

                SaveReturnUserProperties(retConfInfo, ai);

                if (string.IsNullOrEmpty(ai.Subject))
                {
                    ai.Subject = ConfInfo.name;
                }

                //HTML模板
                Microsoft.Office.Interop.Word.Document objDoc = ins.WordEditor as Microsoft.Office.Interop.Word.Document;
                if (null != objDoc)
                {
                    try
                    {
                        //获取当前语言通知模板的路径
                        string strFilePath = string.Empty;
                        strFilePath = SetNotificationLanguage(GetNotificationCurrentLanguage(ThisAddIn.g_AccountInfo.strLanguage));

                        if (!File.Exists(strFilePath))
                        {
                            ThisAddIn.g_log.Error("notification file path not exist.");
                            return PARAM_ERROR;
                        }

                        string textTemplate = System.IO.File.ReadAllText(strFilePath, Encoding.GetEncoding("utf-8"));
                        string strNotify = this.replaceContentsInTemplate(ai, textTemplate, ref retConfInfo);

                        //Clipboard.Clear();
                        VideoConfSettingsForm.CopyHtmlToClipBoard(strNotify);
                        object html = Clipboard.GetData(DataFormats.Html);

                        //paste notification to body
                        ThisAddIn.g_log.Info("schedule paste enter");

                        Section sec = objDoc.Sections.Add(Type.Missing, Type.Missing);
                        sec.Range.InsertBreak(Type.Missing);//插入换行符

                        //2014/11/13 防止异常,邮件体出现空白
                        for (int i = 0; i < 5; i++)
                        {
                            try
                            {
                                sec.Range.PasteAndFormat(WdRecoveryType.wdPasteDefault);
                                break;
                            }
                            catch (System.Exception ex)
                            {
                                ThisAddIn.g_log.Error(ex.Message);
                                Thread.Sleep(500);
                            }
                        }

                        ThisAddIn.g_log.Info("schedule paste end");

                        //send email
                        Outlook.Recipients recipients = ai.Recipients;
                        sendMailNotifications(ai, OperatorType.Schedule, recipients);

                        //3's
                        MessageBoxTimeOut mes = new MessageBoxTimeOut();
                        string strFormat = GlobalResourceClass.getMsg("OPERATOR_MESSAGE");
                        string messageBody = string.Format(strFormat, GlobalResourceClass.getMsg("OPERATOR_TYPE_SCHEDULE"));
                        mes.Show(messageBody, GlobalResourceClass.getMsg("OPERATOR_SUCCESS"), 3000);
                    }
                    catch (System.Exception ex)
                    {
                        ThisAddIn.g_log.Error(string.Format("email notification error,because: {0},{1},{2}.", ex.Source, ex.Message, ex.StackTrace));
                    }
                }
            }
            else
            {
                //2014-5-13 返回码映射
                ThisAddIn.g_log.Error(string.Format("scheduleConf failed with return code:{0}", response.resultCode.ToString()));
            }
            ThisAddIn.g_log.Info("scheduleTPConf exit");
            return response.resultCode;
        }
Exemplo n.º 6
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="ai"></param>
        /// <returns></returns>
        private ConferenceInfo GetConfInfoUserProperty(AppointmentItem ai)
        {
            //如果存在这个属性,则取出,本次为修改会议信息
            UserProperty up = ai.UserProperties.Find(PROPERTY_NAME_CONF_INFO, Type.Missing);
            if (up != null)
            {
                string strValue = up.Value;
                if (string.IsNullOrEmpty(strValue))
                {
                    return null;
                }

                ConferenceInfo confInfo = new ConferenceInfo();
                confInfo.confId = strValue;

                return confInfo;
            }
            else
            {
                return null;
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// 替换通知模板中的内容
        /// </summary>
        /// <param name="textTemplate">通知模板</param>
        /// <param name="confInfo">会议信息</param>  
        /// <returns>新的通知消息</returns>
        private string replaceContentsInTemplate(AppointmentItem ai, string textTemplate, ref ConferenceInfo confInfo)
        {
            //begin 替换模板中的数据
            bool bContain = textTemplate.Contains("{Recurrence_Type}");
            string[] strLanguages = ThisAddIn.g_AccountInfo.strLanguage.Split(';');
            if (true == bContain)
            {
                if (string.Equals(strLanguages[0].ToLower(), "zh_cn"))
                {
                    textTemplate = textTemplate.Replace("{Recurrence_Type}", "开始时间");
                }
                else if (string.Equals(strLanguages[0].ToLower(), "ru") || string.Equals(strLanguages[0].ToLower(), "ru_ru"))
                {
                    textTemplate = textTemplate.Replace("{Recurrence_Type}", "Время Начала");
                }
                else
                {
                    textTemplate = textTemplate.Replace("{Recurrence_Type}", "Start Time");
                }
            }

            bContain = textTemplate.Contains("{Recurrence_Time}");
            if (true == bContain)
            {
                if (string.Equals(strLanguages[0].ToLower(), "zh_cn"))
                {
                    textTemplate = textTemplate.Replace("{Recurrence_Time}", "结束时间");
                }
                else if (string.Equals(strLanguages[0].ToLower(), "ru") || string.Equals(strLanguages[0].ToLower(), "ru_ru"))
                {
                    textTemplate = textTemplate.Replace("{Recurrence_Time}", "Время окончания");
                }
                else
                {
                    textTemplate = textTemplate.Replace("{Recurrence_Time}", "End Time");
                }
            }

            //替换模板中的"会议名称"
            bContain = textTemplate.Contains("{Conf_Subject}");
            string strNewString = "";
            if (true == bContain)
            {
                if (string.IsNullOrEmpty(ai.Subject))
                {
                    strNewString = textTemplate.Replace("{Conf_Subject}", confInfo.name);
                    ai.Subject = confInfo.name;
                }
                else
                {
                    string myEncodedString = HttpUtility.HtmlEncode(ai.Subject);
                    strNewString = textTemplate.Replace("{Conf_Subject}", myEncodedString);
                }
            }

            //替换模板中的"会议密码"
            bContain = strNewString.Contains("{Conf_Password}");
            string strNewString2 = "";
            if (true == bContain)
            {
                UserProperty up = ai.UserProperties.Find(ThisAddIn.PROPERTY_CONFERENCE_PASSWORD, Type.Missing);
                if (up != null)
                {
                    strNewString2 = strNewString.Replace("{Conf_Password}", up.Value);
                }
                else
                {
                    strNewString2 = strNewString.Replace("{Conf_Password}", ThisAddIn.g_SystemSettings.strConfPWD);
                }
            }
            else
            {
                strNewString2 = strNewString;
            }

            //替换模板中的"会议开始时间"
            bContain = strNewString2.Contains("{Conf_Start_Time}");
            string strNewString3 = "";
            if (true == bContain)
            {
                strNewString3 = strNewString2.Replace("{Conf_Start_Time}", ai.Start.ToString() + "   " + ai.StartTimeZone.Name);
            }
            else
            {
                strNewString3 = strNewString2;
            }

            //替换模板中的"会议时长"
            bContain = strNewString3.Contains("{Conf_End_Time}");
            string strNewString4 = "";
            if (true == bContain)
            {
                strNewString4 = strNewString3.Replace("{Conf_End_Time}", ai.End.ToString() + "   " + ai.StartTimeZone.Name);
            }
            else
            {
                strNewString4 = strNewString3;
            }

            //替换模板中的"会议接入号"
            bContain = strNewString4.Contains("{Conf_Access_Number}");
            string strNewString5 = "";
            if (true == bContain)
            {
                if (string.IsNullOrEmpty(confInfo.accessCode))
                {
                    UserProperty upRightBeginTime = ai.UserProperties.Find(PROPERTY_RIGHT_BEGIN_TIME, Type.Missing);
                    string val = upRightBeginTime.Value;
                    List<RecurrenceAppoint> appointList = XmlHelper.Desrialize<List<RecurrenceAppoint>>(val);
                    foreach (RecurrenceAppoint Rappoint in appointList)
                    {
                        if (Rappoint.AppointDate.Equals(ai.Start.ToShortDateString()))
                        {
                            //2015-6-16 w00322557 有前缀则中间添加“-”分割,若无前缀,则无分隔符
                            if (string.IsNullOrEmpty(ThisAddIn.g_AccountInfo.strLync))
                            {
                                strNewString5 = strNewString4.Replace("{Conf_Access_Number}", Rappoint.AccessCode);
                            }
                            else
                            {
                                strNewString5 = strNewString4.Replace("{Conf_Access_Number}", ThisAddIn.g_AccountInfo.strLync + "-" + Rappoint.AccessCode);
                            }

                            confInfo.accessCode = Rappoint.AccessCode;
                            break;
                        }
                    }
                }
                else
                {
                    //2015-6-16 w00322557 有前缀则中间添加“-”分割,若无前缀,则无分隔符
                    if (string.IsNullOrEmpty(ThisAddIn.g_AccountInfo.strLync))
                    {
                        //2014/10/10 修改,增加9000-前缀码
                        strNewString5 = strNewString4.Replace("{Conf_Access_Number}", confInfo.accessCode);
                    }
                    else
                    {
                        //2014/10/10 修改,增加9000-前缀码
                        strNewString5 = strNewString4.Replace("{Conf_Access_Number}", ThisAddIn.g_AccountInfo.strLync + "-" + confInfo.accessCode);
                    }
                }
            }
            else
            {
                strNewString5 = strNewString4;
            }

            //替换模板中的"终端会场"
            bContain = strNewString5.Contains("{Conf_Sites}");
            string strNewString6 = "";
            if (true == bContain)
            {
                string strTempSites = "";

                //2014/10/18 测试
                if (confInfo.sites != null)
                {
                    foreach (SiteInfo site in confInfo.sites)
                    {
                        if (!string.IsNullOrEmpty(site.name))
                        {
                            strTempSites += site.name + "; ";
                        }
                    }
                }
                else
                {
                    foreach (Outlook.Recipient recipient in ai.Recipients)
                    {
                        Outlook.ExchangeUser exchangeUser = recipient.AddressEntry.GetExchangeUser();
                        if (exchangeUser == null || string.IsNullOrEmpty(exchangeUser.JobTitle))
                        {
                            continue;
                        }

                        if (exchangeUser.JobTitle.Equals("VideoRoom"))
                        {
                            strTempSites += recipient.Name + "; ";
                        }
                    }
                }

                strNewString6 = strNewString5.Replace("{Conf_Sites}", strTempSites);
            }

            //替换模板中的"Lync一键入会"
            bContain = strNewString6.Contains("conf_lync_ctc");
            string strNewString7 = "";
            if (true == bContain)
            {
                if (true == ThisAddIn.g_SystemSettings.bLyncCTC)
                {
                    strNewString7 = strNewString6.Replace("conf_lync_ctc", "sip:" + ThisAddIn.g_AccountInfo.strLync + confInfo.accessCode + ThisAddIn.g_AccountInfo.strMCU);
                }
                else
                {
                    strNewString7 = strNewString6.Replace("conf_lync_ctc", "");
                }
            }
            else
            {
                strNewString7 = strNewString6;
            }

            //替换模板中的"数据会议地址"
            bContain = strNewString7.Contains("conf_living_address");
            string strNewString8 = "";
            if (true == bContain)
            {
                strNewString8 = strNewString7.Replace("conf_living_address", confInfo.recorderAddr);
            }
            else
            {
                strNewString8 = strNewString7;
            }

            //替换模板中的"{Prefix_ISDN}"
            bContain = strNewString8.Contains("{Prefix_ISDN}");
            string strNewString9 = "";
            if (true == bContain)
            {
                strNewString9 = strNewString8.Replace("{Prefix_ISDN}", ThisAddIn.g_AccountInfo.strLync);
            }
            else
            {
                strNewString9 = strNewString8;
            }

            //替换模板中的"{Prefix_Cisco}"
            bContain = strNewString9.Contains("{Prefix_Cisco}");
            string strNewString10 = "";
            if (true == bContain)
            {
                //2015-6-16 w00322557 有前缀则中间添加“-”分割,若无前缀,则无分隔符
                if (string.IsNullOrEmpty(ThisAddIn.g_AccountInfo.strCisco))
                {
                    strNewString10 = strNewString9.Replace("{Prefix_Cisco}", confInfo.accessCode);
                }
                else
                {
                    strNewString10 = strNewString9.Replace("{Prefix_Cisco}", ThisAddIn.g_AccountInfo.strCisco + "-" + confInfo.accessCode);
                }

            }
            else
            {
                strNewString10 = strNewString9;
            }

            //
            if (string.IsNullOrEmpty(strNewString10))
            {
                ThisAddIn.g_log.Error("Single template is empty.");
            }
            else
            {
                ThisAddIn.g_log.Info(string.Format("template length is: {0}", strNewString10.Length));
            }

            return strNewString10;
        }
Exemplo n.º 8
0
        /// <summary>
        /// 修改非周期性智真会议
        /// </summary>
        /// <returns>native接口返回值</returns>
        private int editTPConf(AppointmentItem ai, ref ConferenceInfo ConfInfo, MeetingItem meetingItem)
        {
            ThisAddIn.g_log.Info("editTPConf enter");
            Inspector ins = ai.GetInspector;

            setConferenceInfo(ref ConfInfo, ai);
            ConfInfo.accessCode = string.Empty;

            TPOASDKResponse<ConferenceInfo> response = null;
            int resultCode = -1;
            //非周期性会议
            //2015-5-25 w00322557 账号传入“eSDK账号,Outlook邮箱账号”
            //string strAccountName = ThisAddIn.g_AccountInfo.strUserName;
            Outlook.ExchangeUser mainUser = Globals.ThisAddIn.Application.Session.CurrentUser.AddressEntry.GetExchangeUser();
            string strOutlookAccount = string.Empty;
            if (mainUser != null)
            {
                strOutlookAccount = mainUser.PrimarySmtpAddress;
            }

            string strAccountName = string.Format("{0},{1}", ThisAddIn.g_AccountInfo.strUserName, strOutlookAccount);
            string strAccountPWD = ThisAddIn.g_AccountInfo.strPWD;
            string strServerAddress = ThisAddIn.g_AccountInfo.strServer;

            ThisAddIn.g_log.Debug(string.Format("Account is: {0}", strAccountName));
            ThisAddIn.g_log.Debug("PWD is: ******");
            ThisAddIn.g_log.Debug(string.Format("Server is: {0}", strServerAddress));

            try
            {
                //密码不存在,返回
                if (string.IsNullOrEmpty(ThisAddIn.g_AccountInfo.strPWD))
                {
                    ThisAddIn.g_log.Info("pwd is null");
                    MessageBox.Show(GlobalResourceClass.getMsg("INPUT_OUTLOOK_PASSWORD"));
                }

                ConferenceMgrService conferenceServiceEx = ConferenceMgrService.Instance(strAccountName, strAccountPWD, strServerAddress);
                response = conferenceServiceEx.editScheduledConf(ConfInfo);
                resultCode = response.resultCode;
            }
            catch (System.Exception ex)
            {
                ThisAddIn.g_log.Error(string.Format("editScheduledConf exception because :{0} ", ex.Message));

                return PARAM_ERROR;
            }

            if (0 == resultCode)
            {
                if (string.IsNullOrEmpty(ai.Subject))
                {
                    ai.Subject = ConfInfo.name;
                }
                //修改成功,将返回的confId作为属性保存
                if (response != null)//第一次执行的
                {
                    ConferenceInfo retConfInfo = response.result;
                    SaveReturnUserProperties(retConfInfo, ai);

                    //HTML模板
                    Microsoft.Office.Interop.Word.Document objDoc = ins.WordEditor as Microsoft.Office.Interop.Word.Document;
                    if (null != objDoc)
                    {
                        //读入会议通知模板数据
                        string strFilePath = string.Empty;
                        strFilePath = SetNotificationLanguage(GetNotificationCurrentLanguage(ThisAddIn.g_AccountInfo.strLanguage));

                        if (!File.Exists(strFilePath))
                        {
                            ThisAddIn.g_log.Error("notification file path not exist.");
                            return PARAM_ERROR;
                        }

                        string textTemplate = System.IO.File.ReadAllText(strFilePath, Encoding.GetEncoding("utf-8"));
                        string strNotify = this.replaceContentsInTemplate(ai, textTemplate, ref retConfInfo);

                        //将会议通知模板数据拷贝/粘贴到文档中
                        Clipboard.Clear();
                        VideoConfSettingsForm.CopyHtmlToClipBoard(strNotify);
                        object html = Clipboard.GetData(DataFormats.Html);

                        ThisAddIn.g_log.Info("edit TP paste enter");
                        objDoc.Range().WholeStory();
                        try
                        {
                            objDoc.Range().PasteAndFormat(WdRecoveryType.wdPasteDefault);
                        }
                        catch (System.Exception ex)
                        {
                            ThisAddIn.g_log.Error(ex.Message);
                        }
                        ThisAddIn.g_log.Info("edit TP paste end");
                    }
                }
                SendRecipientsInfo(ai, meetingItem);

                MessageBoxTimeOut mes = new MessageBoxTimeOut();
                string messageBody = string.Format(GlobalResourceClass.getMsg("OPERATOR_MESSAGE"), GlobalResourceClass.getMsg("OPERATOR_TYPE_MODIFY"));
                mes.Show(messageBody, GlobalResourceClass.getMsg("OPERATOR_SUCCESS"), 3000);

            }
            else
            {
                //2014-5-13 返回码映射
                ThisAddIn.g_log.Error(string.Format("editTPConf failed with error code: {0}", response.resultCode.ToString()));
            }

            ThisAddIn.g_log.Info("editTPConf exit");
            return resultCode;
        }
Exemplo n.º 9
0
        /// <summary>
        /// 删除周期会议的子会议
        /// </summary>
        /// <param name="tempAppt"></param>
        /// <param name="recipients"></param>
        /// <param name="date"></param>
        /// <returns></returns>
        private int DeleteConferenceWithTime(AppointmentItem tempAppt, Recipients recipients, DateTime date)
        {
            ThisAddIn.g_log.Info(string.Format("Delete Conference ,Time is {0}", date.ToString()));

            int resultCode = PARAM_ERROR;
            object confInfo = null;
            string confId = "";

            confInfo = this.GetConfInfoUserProperty(tempAppt);
            if (null == confInfo)
            {
                return PARAM_ERROR;
            }
            confId = ((ConferenceInfo)confInfo).confId;

            //获取已预约的会议信息
            //2015-5-25 w00322557 账号传入“eSDK账号,Outlook邮箱账号”
            //string strAccountName = ThisAddIn.g_AccountInfo.strUserName;
            Outlook.ExchangeUser mainUser = Globals.ThisAddIn.Application.Session.CurrentUser.AddressEntry.GetExchangeUser();
            string strOutlookAccount = string.Empty;
            if (mainUser != null)
            {
                strOutlookAccount = mainUser.PrimarySmtpAddress;
            }

            string strAccountName = string.Format("{0},{1}", ThisAddIn.g_AccountInfo.strUserName, strOutlookAccount);
            string strAccountPWD = ThisAddIn.g_AccountInfo.strPWD;
            string strServerAddress = ThisAddIn.g_AccountInfo.strServer;

            ThisAddIn.g_log.Debug(string.Format("Account is: {0}", strAccountName));
            ThisAddIn.g_log.Debug("PWD is: ******");
            ThisAddIn.g_log.Debug(string.Format("Server is: {0}", strServerAddress));

            try
            {
                //密码不存在,返回
                if (string.IsNullOrEmpty(ThisAddIn.g_AccountInfo.strPWD))
                {
                    ThisAddIn.g_log.Info("pwd is null");
                    MessageBox.Show(GlobalResourceClass.getMsg("INPUT_OUTLOOK_PASSWORD"));
                }

                ConferenceMgrService conferenceServiceEx = ConferenceMgrService.Instance(strAccountName, strAccountPWD, strServerAddress);
                resultCode = conferenceServiceEx.delScheduledConf(confId, date.ToUniversalTime());
            }
            catch (System.Exception ex)
            {
                ThisAddIn.g_log.Error(string.Format("DeleteConferenceWithTime exception: {0}", ex.Message));
                return PARAM_ERROR;
            }

            if (0 == resultCode)
            {
                ThisAddIn.g_log.Info(String.Format("delScheduledConf date: {0}", date.ToString()));
                ThisAddIn.g_log.Info(String.Format("delScheduledConf result code:{0:D}", resultCode));

                //2014/10/18 测试
                if (date != null)//删除单个子会议,修改模板
                {
                    //HTML模板
                    Microsoft.Office.Interop.Word.Document objDoc = tempAppt.GetInspector.WordEditor as Microsoft.Office.Interop.Word.Document;
                    if (null != objDoc)
                    {
                        string strFilePath = string.Empty;
                        strFilePath = SetNotificationLanguage(GetNotificationCurrentLanguage(ThisAddIn.g_AccountInfo.strLanguage));

                        if (!File.Exists(strFilePath))
                        {
                            ThisAddIn.g_log.Error("notification file path not exist.");
                            return PARAM_ERROR;
                        }

                        //读取会议邮件通知模板内容
                        string textTemplate = System.IO.File.ReadAllText(strFilePath, Encoding.GetEncoding("utf-8"));

                        ConferenceInfo cInfo = new ConferenceInfo();
                        string strNotify = replaceContentsInTemplate(tempAppt, textTemplate, ref cInfo);

                        //将会议通知模板数据拷贝/粘贴到文档中
                        Clipboard.Clear();
                        VideoConfSettingsForm.CopyHtmlToClipBoard(strNotify);
                        object html = Clipboard.GetData(DataFormats.Html);

                        ThisAddIn.g_log.Info("delete single recurrence paste enter");
                        objDoc.Range().WholeStory();

                        try
                        {
                            objDoc.Range().PasteAndFormat(WdRecoveryType.wdPasteDefault);
                        }
                        catch (System.Exception ex)
                        {
                            ThisAddIn.g_log.Error(ex.Message);
                        }

                        ThisAddIn.g_log.Info("delete single recurrence paste end");
                    }
                }
                if (recipients == null)
                {
                    recipients = tempAppt.Recipients;
                }

                sendMailNotifications(tempAppt, OperatorType.Cancel, recipients);

                MessageBoxTimeOut mes = new MessageBoxTimeOut();
                string messageBody = string.Format(GlobalResourceClass.getMsg("OPERATOR_MESSAGE"), GlobalResourceClass.getMsg("OPERATOR_TYPE_CANCEL"));
                mes.Show(messageBody, GlobalResourceClass.getMsg("OPERATOR_SUCCESS"), 3000);
                return 0;
            }
            else
            {
                ThisAddIn.g_log.Error(String.Format("delScheduledConf failed:{0:D}", resultCode));
                return resultCode;
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// 删除预约会议
        /// </summary>
        /// <param name="tempAppt">相应的AppointmentItem</param>
        private int DeleteConference(AppointmentItem tempAppt, Recipients recipients)
        {
            int resultCode = PARAM_ERROR;
            object confInfo = null;
            string confId = "";
            DateTime? date = null;

            confInfo = this.GetConfInfoUserProperty(tempAppt);
            if (null == confInfo)
            {
                return PARAM_ERROR;
            }
            confId = ((ConferenceInfo)confInfo).confId;

            //获取已预约的会议信息
            //2015-5-25 w00322557 账号传入“eSDK账号,Outlook邮箱账号”
            //string strAccountName = ThisAddIn.g_AccountInfo.strUserName;
            Outlook.ExchangeUser mainUser = Globals.ThisAddIn.Application.Session.CurrentUser.AddressEntry.GetExchangeUser();
            string strOutlookAccount = string.Empty;
            if (mainUser != null)
            {
                strOutlookAccount = mainUser.PrimarySmtpAddress;
            }

            string strAccountName = string.Format("{0},{1}", ThisAddIn.g_AccountInfo.strUserName, strOutlookAccount);
            string strAccountPWD = ThisAddIn.g_AccountInfo.strPWD;
            string strServerAddress = ThisAddIn.g_AccountInfo.strServer;

            ThisAddIn.g_log.Debug(string.Format("Account is: {0}", strAccountName));
            ThisAddIn.g_log.Debug("PWD is: ******");
            ThisAddIn.g_log.Debug(string.Format("Server is: {0}", strServerAddress));

            if (OlRecurrenceState.olApptException == tempAppt.RecurrenceState)//删除单个
            {
                date = tempAppt.Start.ToUniversalTime();
            }

            try
            {
                //密码不存在,返回
                if (string.IsNullOrEmpty(ThisAddIn.g_AccountInfo.strPWD))
                {
                    ThisAddIn.g_log.Info("pwd is null");
                    MessageBox.Show(GlobalResourceClass.getMsg("INPUT_OUTLOOK_PASSWORD"));
                }

                ConferenceMgrService conferenceServiceEx = ConferenceMgrService.Instance(strAccountName, strAccountPWD, strServerAddress);
                resultCode = conferenceServiceEx.delScheduledConf(confId, date);
            }
            catch (System.Exception ex)
            {
                ThisAddIn.g_log.Error(ex.Message);
                return PARAM_ERROR;
            }

            if (0 == resultCode)
            {
                ThisAddIn.g_log.Info(String.Format("delScheduledConf date: {0}", date.ToString()));
                ThisAddIn.g_log.Info(String.Format("delScheduledConf success:{0:D}", resultCode));

                //2014/10/18 测试
                if (date != null)//删除单个子会议,修改模板
                {
                    //HTML模板
                    Microsoft.Office.Interop.Word.Document objDoc = tempAppt.GetInspector.WordEditor as Microsoft.Office.Interop.Word.Document;
                    if (null != objDoc)
                    {
                        string strFilePath = string.Empty;
                        strFilePath = SetNotificationLanguage(GetNotificationCurrentLanguage(ThisAddIn.g_AccountInfo.strLanguage));

                        if (!File.Exists(strFilePath))
                        {
                            ThisAddIn.g_log.Error("notification file path not exist.");
                            return PARAM_ERROR;
                        }

                        //读取会议邮件通知模板内容
                        string textTemplate = System.IO.File.ReadAllText(strFilePath, Encoding.GetEncoding("utf-8"));

                        ConferenceInfo cInfo = new ConferenceInfo();

                        //2015-6-17 w00322557 增加解析会场
                        try
                        {
                            UserProperty upRightBeginTime = tempAppt.UserProperties.Find(PROPERTY_RIGHT_BEGIN_TIME, Type.Missing);
                            if (upRightBeginTime != null)
                            {
                                string val = upRightBeginTime.Value;

                                List<RecurrenceAppoint> appointList = XmlHelper.Desrialize<List<RecurrenceAppoint>>(val);
                                foreach (RecurrenceAppoint Rappoint in appointList)
                                {

                                    if (Rappoint.AppointDate.Equals(date.Value.ToLocalTime().ToShortDateString()) &&
                                        Rappoint.AppointTime.Equals(date.Value.ToLocalTime().ToLongTimeString()))
                                    {
                                        string sSites = Rappoint.AppointSites.TrimEnd(',');
                                        string[] varSites = sSites.Split(',');
                                        cInfo.sites = new SiteInfo[varSites.Length];
                                        int iCount = 0;
                                        foreach (string sSite in varSites)
                                        {
                                            SiteInfo site = new SiteInfo();
                                            site.name = sSite;
                                            cInfo.sites[iCount] = site;
                                            iCount++;
                                        }
                                    }
                                }
                            }
                        }
                        catch (System.Exception ex)
                        {
                            ThisAddIn.g_log.Error(string.Format("Parse site error with: {0}", ex.Message));
                        }

                        string strNotify = replaceContentsInTemplate(tempAppt, textTemplate, ref cInfo);

                        //将会议通知模板数据拷贝/粘贴到文档中
                        Clipboard.Clear();
                        VideoConfSettingsForm.CopyHtmlToClipBoard(strNotify);
                        object html = Clipboard.GetData(DataFormats.Html);

                        ThisAddIn.g_log.Info("delete single recurrence paste enter");
                        objDoc.Range().WholeStory();

                        try
                        {
                            objDoc.Range().PasteAndFormat(WdRecoveryType.wdPasteDefault);
                        }
                        catch (System.Exception ex)
                        {
                            ThisAddIn.g_log.Error(ex.Message);
                        }

                        ThisAddIn.g_log.Info("delete single recurrence paste end");
                    }
                }
                if (recipients == null)
                {
                    recipients = tempAppt.Recipients;
                }

                sendMailNotifications(tempAppt, OperatorType.Cancel, recipients);

                MessageBoxTimeOut mes = new MessageBoxTimeOut();
                string messageBody = string.Format(GlobalResourceClass.getMsg("OPERATOR_MESSAGE"), GlobalResourceClass.getMsg("OPERATOR_TYPE_CANCEL"));
                mes.Show(messageBody, GlobalResourceClass.getMsg("OPERATOR_SUCCESS"), 3000);
                return 0;
            }
            else
            {
                ThisAddIn.g_log.Error(String.Format("delScheduledConf failed:{0:D}", resultCode));
                return resultCode;
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// 保存用户自定义属性
        /// </summary>
        /// <param name="confInfo"></param>
        /// <param name="ai"></param>
        public static void SaveReturnUserProperties(ConferenceInfo confInfo, AppointmentItem ai)
        {
            ThisAddIn.g_log.Info(string.Format("SaveReturnUserProperties begin"));
            try
            {
                //confId
                UserProperty upConfoID = ai.UserProperties.Add(PROPERTY_NAME_CONF_INFO, Outlook.OlUserPropertyType.olText, Type.Missing, Type.Missing);
                upConfoID.Value = confInfo.confId;
                ThisAddIn.g_log.Info(string.Format("return conf id is: {0}", confInfo.confId));

                //access code
                UserProperty upAccessCode = ai.UserProperties.Add(PROPERTY_ACCESS_CODE, Outlook.OlUserPropertyType.olText, Type.Missing, Type.Missing);
                upAccessCode.Value = confInfo.accessCode;
                ThisAddIn.g_log.Info(string.Format("return conf access code is: {0}", confInfo.accessCode));

                //recording address
                UserProperty upRecordingAddress = ai.UserProperties.Add(PROPERTY_RECORDING_ADDRESS, Outlook.OlUserPropertyType.olText, Type.Missing, Type.Missing);
                upRecordingAddress.Value = confInfo.recorderAddr;
                ThisAddIn.g_log.Info(string.Format("return conf recorder url is: {0}", confInfo.recorderAddr));
            }
            catch (System.Exception ex)
            {
                ThisAddIn.g_log.Error(string.Format("SaveReturnUserProperties exception,{0}", ex.Message));
                MessageBox.Show(ex.Message);
            }
            ThisAddIn.g_log.Info(string.Format("SaveReturnUserProperties end"));
        }
Exemplo n.º 12
0
        /// <summary>
        /// 删除周期会议的子会议
        /// </summary>
        /// <param name="tempAppt"></param>
        /// <param name="recipients"></param>
        /// <param name="date"></param>
        /// <returns></returns>
        private int DeleteConferenceWithTime(AppointmentItem tempAppt, Recipients recipients, DateTime date)
        {
            ThisAddIn.g_log.Info(string.Format("Delete Conference ,Time is {0}", date.ToString()));

            int resultCode = PARAM_ERROR;
            object confInfo = null;
            string confId = "";

            confInfo = this.GetConfInfoUserProperty(tempAppt);
            if (null == confInfo)
            {
                return PARAM_ERROR;
            }
            confId = ((ConferenceInfo)confInfo).confId;

            //2015-5-25 w00322557 账号传入“eSDK账号,Outlook邮箱账号”
            //string strAccountName = ThisAddIn.g_AccountInfo.strUserName;
            Outlook.ExchangeUser mainUser = Globals.ThisAddIn.Application.Session.CurrentUser.AddressEntry.GetExchangeUser();
            string strOutlookAccount = string.Empty;
            if (mainUser != null)
            {
                strOutlookAccount = mainUser.PrimarySmtpAddress;
            }

            string strAccountName = string.Format("{0},{1}", ThisAddIn.g_AccountInfo.strUserName, strOutlookAccount);
            string strAccountPWD = ThisAddIn.g_AccountInfo.strPWD;
            string strServerAddress = ThisAddIn.g_AccountInfo.strServer;

            ThisAddIn.g_log.Debug(string.Format("Account is: {0}", strAccountName));
            ThisAddIn.g_log.Debug("PWD is: ******");
            ThisAddIn.g_log.Debug(string.Format("Server is: {0}", strServerAddress));

            try
            {
                ConferenceMgrService conferenceServiceEx = ConferenceMgrService.Instance(strAccountName, strAccountPWD, strServerAddress);
                resultCode = conferenceServiceEx.delScheduledConf(confId, date.ToUniversalTime());
            }
            catch (System.Exception ex)
            {
                ThisAddIn.g_log.Error(ex.Message);
                return PARAM_ERROR;
            }

            if (0 == resultCode)
            {
                ThisAddIn.g_log.Info(String.Format("delScheduledConf date: {0}", date.ToString()));
                ThisAddIn.g_log.Info(String.Format("delScheduledConf success:{0:D}", resultCode));

                //2014/10/18 测试
                if (date != null)//删除单个子会议,修改模板
                {
                    //HTML模板
                    Microsoft.Office.Interop.Word.Document objDoc = tempAppt.GetInspector.WordEditor as Microsoft.Office.Interop.Word.Document;
                    if (null != objDoc)
                    {
                        string strFilePath = string.Empty;
                        strFilePath = SetNotificationLanguage(GetNotificationCurrentLanguage(ThisAddIn.g_AccountInfo.strLanguage));

                        if (!File.Exists(strFilePath))
                        {
                            ThisAddIn.g_log.Error("notification file path not exist.");
                            return PARAM_ERROR;
                        }

                        //读取会议邮件通知模板内容
                        string textTemplate = System.IO.File.ReadAllText(strFilePath, Encoding.GetEncoding("utf-8"));

                        ConferenceInfo cInfo = new ConferenceInfo();
                        string strNotify = replaceContentsInTemplate(tempAppt, textTemplate, ref cInfo);

                        //将会议通知模板数据拷贝/粘贴到文档中
                        Clipboard.Clear();
                        VideoConfSettingsForm.CopyHtmlToClipBoard(strNotify);
                        object html = Clipboard.GetData(DataFormats.Html);

                        //                         ThisAddIn.g_log.Info("edit recurrence paste enter");
                        //                         objDoc.Range().WholeStory();

                        //                         try
                        //                         {
                        ////objDoc.Range().PasteAndFormat(WdRecoveryType.wdPasteDefault);
                        //objDoc.Range().PasteAndFormat(WdRecoveryType.wdFormatOriginalFormatting);
                        //                         }
                        //                         catch (System.Exception ex)
                        //                         {
                        //                             ThisAddIn.g_log.Error(ex.Message);
                        //                         }
                        //
                        //                         ThisAddIn.g_log.Info("edit recurrence paste end");

                        //2014/12/16 新增
                        ThisAddIn.g_log.Info("sendMailNotifications enter");
                        MailItem email = this.Application.CreateItem(OlItemType.olMailItem);
                        string smtpAddress = "";

                        if (recipients == null)
                        {
                            recipients = tempAppt.Recipients;
                        }

                        foreach (Outlook.Recipient recipient in recipients)
                        {
                            smtpAddress += recipient.Address + ";";//添加收件人地址

                        }

                        email.To = smtpAddress;  //收件人地址
                        email.Subject = "[Successfully Cancelled]" + tempAppt.Subject;
                        email.BodyFormat = OlBodyFormat.olFormatHTML;//body格式
                        email.HTMLBody = strNotify;
                        ((Outlook._MailItem)email).Send();//发送邮件
                        ThisAddIn.g_log.Info("sendMailNotifications exit");

                        Marshal.ReleaseComObject(objDoc);
                        objDoc = null;
                    }
                }

                //MessageBoxTimeOut mes = new MessageBoxTimeOut();
                string messageBody = string.Format(GlobalResourceClass.getMsg("OPERATOR_MESSAGE"), GlobalResourceClass.getMsg("OPERATOR_TYPE_CANCEL"));
                //mes.Show(messageBody, GlobalResourceClass.getMsg("OPERATOR_SUCCESS"), 3000);

                WinDialog win = new WinDialog(messageBody, GlobalResourceClass.getMsg("OPERATOR_SUCCESS"), 3000);
                win.ShowDialog();

                return 0;
            }
            else
            {
                ThisAddIn.g_log.Error(String.Format("delScheduledConf failed:{0:D}", resultCode));
                return resultCode;
            }
        }