Exemplo n.º 1
0
        /// <summary>
        /// Imports the specified SSO config file to BizTalk SSODB.
        /// </summary>
        /// <param name="ssoKey">Key to import SSO file.</param>
        /// <param name="ssoEncryptedFile">Full path of the SSO config file, from where to import.</param>
        /// <param name="ssoConfigappName">Application name under which the SSO will be imported.</param>
        /// <param name="SSOConfigContactInfo">SSOConfigContactInfo , which will make the config visible in SSO Admin mmc. The name has to be the one which was specified while installing Microsoft SSO MMC snapIn tool.</param>
        /// <param name="redeploy">Boolean, Redeploy flag (True: Deletes existing SSO and imports the new, False : Imports the new SSO without deleting previous one).</param>
        /// <returns>Returns true/fasle.</returns>
        public static bool ImportSSOconfig(string ssoKey, string ssoEncryptedFile, string ssoConfigappName, string SSOConfigContactInfo, bool redeploy,
                                           out string exceptionMessage)
        {
            bool result = false;

            try
            {
                exceptionMessage = string.Empty;
                ISSOAdmin ssoAdmin = new ISSOAdmin();
                if (redeploy)
                {
                    ssoAdmin.DeleteApplication(ssoConfigappName);
                }
                MSBuildTasks.ImportSSOConfigurationApplicationTask import = new MSBuildTasks.ImportSSOConfigurationApplicationTask();
                import.EncryptionKey = ssoKey;
                import.EncryptedFile = ssoEncryptedFile;
                result = import.Execute();
                if (result)
                {
                    ssoAdmin.UpdateSSOCompanyName(ssoConfigappName, SSOConfigContactInfo);
                }
            }
            catch (Exception exe)
            {
                exceptionMessage = exe.Message;
                result           = false;
            }
            return(result);
        }