Exemplo n.º 1
0
        private SubscriptionState GetSubscriptionState(string textualSubId)
        {
            if (textualSubId == null)
            {
                throw new ArgumentNullException("textualSubId", Resources.GetString("Ex_ComArgSubIdentityNull"));
            }
            DefinitionIdentity subId;

            try
            {
                subId = new DefinitionIdentity(textualSubId);
            }
            catch (COMException ex)
            {
                throw new DeploymentException(ExceptionTypes.SubscriptionState, string.Format((IFormatProvider)CultureInfo.CurrentCulture, Resources.GetString("Ex_ComArgSubIdentityNotValid"), new object[1]
                {
                    (object)textualSubId
                }), (Exception)ex);
            }
            catch (SEHException ex)
            {
                throw new DeploymentException(ExceptionTypes.SubscriptionState, string.Format((IFormatProvider)CultureInfo.CurrentCulture, Resources.GetString("Ex_ComArgSubIdentityNotValid"), new object[1]
                {
                    (object)textualSubId
                }), (Exception)ex);
            }
            if (subId.Version != (Version)null)
            {
                throw new DeploymentException(ExceptionTypes.SubscriptionState, Resources.GetString("Ex_ComArgSubIdentityWithVersion"));
            }
            SubscriptionStore currentUser = SubscriptionStore.CurrentUser;

            currentUser.RefreshStorePointer();
            return(currentUser.GetSubscriptionState(subId));
        }
Exemplo n.º 2
0
        /// <summary>Removes a previously installed user-defined component of an application.</summary>
        /// <param name="subscriptionId">A string that contains a subscription identifier, which indicates the add-in to remove.</param>
        /// <exception cref="T:System.ArgumentException">
        /// <paramref name="subscriptionId" /> is not a valid subscription identity, or does not include a name, public key token, processor architecture, and version number.</exception>
        /// <exception cref="T:System.ArgumentNullException">
        /// <paramref name="subscriptionId" /> is null.</exception>
        public static void UninstallCustomAddIn(string subscriptionId)
        {
            DefinitionIdentity subIdAndValidate = InPlaceHostingManager.GetSubIdAndValidate(subscriptionId);
            SubscriptionStore  currentUser      = SubscriptionStore.CurrentUser;

            currentUser.RefreshStorePointer();
            SubscriptionState subscriptionState = currentUser.GetSubscriptionState(subIdAndValidate);

            subscriptionState.SubscriptionStore.UninstallCustomHostSpecifiedSubscription(subscriptionState);
        }
        public static void UninstallCustomUXApplication(string subscriptionId)
        {
            DefinitionIdentity subId = null;

            subId = GetSubIdAndValidate(subscriptionId);
            SubscriptionStore currentUser = SubscriptionStore.CurrentUser;

            currentUser.RefreshStorePointer();
            SubscriptionState subscriptionState = currentUser.GetSubscriptionState(subId);

            subscriptionState.SubscriptionStore.UninstallCustomUXSubscription(subscriptionState);
        }