Beispiel #1
0
        internal override ExtensionData GetExtensionDataForInstall(IRecipientSession adRecipientSession)
        {
            ExtensionData extensionDataForInstall = base.GetExtensionDataForInstall(adRecipientSession);

            extensionDataForInstall.IsMandatory        = (base.DefaultStateForUser == Microsoft.Exchange.Management.Extension.DefaultStateForUser.AlwaysEnabled);
            extensionDataForInstall.IsEnabledByDefault = (base.DefaultStateForUser == Microsoft.Exchange.Management.Extension.DefaultStateForUser.Enabled);
            extensionDataForInstall.ProvidedTo         = this.ProvidedTo;
            extensionDataForInstall.SpecificUsers      = OrgApp.ConvertPresentationFormatToWireUserList(adRecipientSession, this.UserList);
            return(extensionDataForInstall);
        }
        protected void InternalSave(ConfigurableObject instance)
        {
            if (instance == null)
            {
                throw new ArgumentNullException("instance");
            }
            App owaExtension = instance as App;

            if (owaExtension == null)
            {
                throw new NotSupportedException("Save: " + instance.GetType().FullName);
            }
            OWAExtensionDataProvider.RunAction(delegate
            {
                switch (owaExtension.ObjectState)
                {
                case ObjectState.New:
                    if (!owaExtension.IsDownloadOnly)
                    {
                        OrgExtensionTable.SetOrgExtension(this.domain, 0, null, owaExtension.GetExtensionDataForInstall(this.adRecipientSession));
                        return;
                    }
                    break;

                case ObjectState.Unchanged:
                    break;

                case ObjectState.Changed:
                    {
                        OrgApp orgApp = instance as OrgApp;
                        if (orgApp == null)
                        {
                            throw new NotSupportedException("Save: " + instance.GetType().FullName);
                        }
                        OrgExtensionTable.ConfigureOrgExtension(this.domain, orgApp.AppId, orgApp.Enabled, orgApp.DefaultStateForUser == DefaultStateForUser.AlwaysEnabled, orgApp.DefaultStateForUser == DefaultStateForUser.Enabled, orgApp.ProvidedTo, OrgApp.ConvertPresentationFormatToWireUserList(this.adRecipientSession, orgApp.UserList));
                        break;
                    }

                default:
                    return;
                }
            });
        }
Beispiel #3
0
        protected override void InternalSave(ConfigurableObject instance)
        {
            if (instance == null)
            {
                throw new ArgumentNullException("instance");
            }
            App owaExtension = instance as App;

            if (owaExtension == null)
            {
                throw new NotSupportedException("Save: " + instance.GetType().FullName);
            }
            OWAExtensionDataProvider.RunAction(delegate
            {
                using (InstalledExtensionTable installedExtensionTable = InstalledExtensionTable.CreateInstalledExtensionTable(this.domain, this.isUserScope, null, this.MailboxSession))
                {
                    switch (owaExtension.ObjectState)
                    {
                    case ObjectState.New:
                        if (!owaExtension.IsDownloadOnly)
                        {
                            installedExtensionTable.InstallExtension(owaExtension.GetExtensionDataForInstall(this.adRecipientSession), false);
                        }
                        break;

                    case ObjectState.Changed:
                        if (this.isUserScope)
                        {
                            installedExtensionTable.ConfigureUserExtension(owaExtension.AppId, owaExtension.Enabled);
                        }
                        else
                        {
                            OrgApp orgApp = instance as OrgApp;
                            if (orgApp == null)
                            {
                                throw new NotSupportedException("Save: " + instance.GetType().FullName);
                            }
                            installedExtensionTable.ConfigureOrgExtension(orgApp.AppId, orgApp.Enabled, orgApp.DefaultStateForUser == DefaultStateForUser.AlwaysEnabled, orgApp.DefaultStateForUser == DefaultStateForUser.Enabled, orgApp.ProvidedTo, OrgApp.ConvertPresentationFormatToWireUserList(this.adRecipientSession, orgApp.UserList));
                        }
                        break;
                    }
                }
            });
        }