Fix archiving

This commit is contained in:
dev_amdtel 2014-05-15 20:52:56 +04:00
parent 2170367f8f
commit 56cf823559
19 changed files with 371 additions and 179 deletions

View file

@ -3451,18 +3451,18 @@ GO
-- Exchange2013 Archiving
-- Exchange2013 Archiving Quotas
IF EXISTS (SELECT * FROM [dbo].[Quotas] WHERE [QuotaName] = 'Exchange2013.AllowArchiving')
IF EXISTS (SELECT * FROM [dbo].[Quotas] WHERE [QuotaID] = 424)
BEGIN
UPDATE [dbo].[Quotas] SET [QuotaName]=N'Exchange2013.AllowRetentionPolicy', [QuotaDescription]=N'Allow Retention Policy'
WHERE [QuotaName] = 'Exchange2013.AllowArchiving'
WHERE [QuotaID] = 424
END
GO
IF NOT EXISTS (SELECT * FROM [dbo].[Quotas] WHERE [QuotaName] = 'Exchange2013.AllowRetentionPolicy')
BEGIN
INSERT [dbo].[Quotas] ([QuotaID], [GroupID],[QuotaOrder], [QuotaName], [QuotaDescription], [QuotaTypeID], [ServiceQuota], [ItemTypeID], [HideQuota])
@ -3470,7 +3470,6 @@ VALUES (424, 12, 27,N'Exchange2013.AllowRetentionPolicy',N'Allow Retention Polic
END
GO
IF NOT EXISTS (SELECT * FROM [dbo].[Quotas] WHERE [QuotaName] = 'Exchange2013.ArchivingStorage')
BEGIN
INSERT [dbo].[Quotas] ([QuotaID], [GroupID], [QuotaOrder], [QuotaName], [QuotaDescription], [QuotaTypeID], [ServiceQuota], [ItemTypeID], [HideQuota])
@ -3485,6 +3484,14 @@ VALUES (426, 12, 28, N'Exchange2013.ArchivingMailboxes', N'Archiving Mailboxes p
END
GO
IF NOT EXISTS (SELECT * FROM [dbo].[Quotas] WHERE [QuotaName] = 'Exchange2013.AllowArchiving')
BEGIN
INSERT [dbo].[Quotas] ([QuotaID], [GroupID],[QuotaOrder], [QuotaName], [QuotaDescription], [QuotaTypeID], [ServiceQuota], [ItemTypeID], [HideQuota])
VALUES (427, 12, 27,N'Exchange2013.AllowArchiving',N'Allow Archiving',1, 0 , NULL, NULL)
END
GO
-- Exchange2013 Archiving Plans
IF NOT EXISTS(select 1 from sys.columns COLS INNER JOIN sys.objects OBJS ON OBJS.object_id=COLS.object_id and OBJS.type='U' AND OBJS.name='ExchangeMailboxPlans' AND COLS.name='Archiving')
BEGIN
@ -3500,6 +3507,15 @@ ALTER TABLE [dbo].[ExchangeMailboxPlans] ADD
END
GO
IF NOT EXISTS(select 1 from sys.columns COLS INNER JOIN sys.objects OBJS ON OBJS.object_id=COLS.object_id and OBJS.type='U' AND OBJS.name='ExchangeMailboxPlans' AND COLS.name='ArchiveSizeMB')
BEGIN
ALTER TABLE [dbo].[ExchangeMailboxPlans] ADD
[ArchiveSizeMB] [int] NULL,
[ArchiveWarningPct] [int] NULL
END
GO
ALTER PROCEDURE [dbo].[AddExchangeMailboxPlan]
(
@MailboxPlanId int OUTPUT,
@ -3527,7 +3543,9 @@ ALTER PROCEDURE [dbo].[AddExchangeMailboxPlan]
@LitigationHoldUrl nvarchar(256),
@LitigationHoldMsg nvarchar(512),
@Archiving bit,
@EnableArchiving bit
@EnableArchiving bit,
@ArchiveSizeMB int,
@ArchiveWarningPct int
)
AS
@ -3569,7 +3587,9 @@ INSERT INTO ExchangeMailboxPlans
LitigationHoldUrl,
LitigationHoldMsg,
Archiving,
EnableArchiving
EnableArchiving,
ArchiveSizeMB,
ArchiveWarningPct
)
VALUES
(
@ -3597,7 +3617,9 @@ VALUES
@LitigationHoldUrl,
@LitigationHoldMsg,
@Archiving,
@EnableArchiving
@EnableArchiving,
@ArchiveSizeMB,
@ArchiveWarningPct
)
SET @MailboxPlanId = SCOPE_IDENTITY()
@ -3632,7 +3654,9 @@ ALTER PROCEDURE [dbo].[UpdateExchangeMailboxPlan]
@LitigationHoldUrl nvarchar(256),
@LitigationHoldMsg nvarchar(512),
@Archiving bit,
@EnableArchiving bit
@EnableArchiving bit,
@ArchiveSizeMB int,
@ArchiveWarningPct int
)
AS
@ -3660,9 +3684,9 @@ UPDATE ExchangeMailboxPlans SET
LitigationHoldUrl = @LitigationHoldUrl,
LitigationHoldMsg = @LitigationHoldMsg,
Archiving = @Archiving,
EnableArchiving = @EnableArchiving
EnableArchiving = @EnableArchiving,
ArchiveSizeMB = @ArchiveSizeMB,
ArchiveWarningPct = @ArchiveWarningPct
WHERE MailboxPlanId = @MailboxPlanId
RETURN
@ -3698,7 +3722,9 @@ SELECT
HideFromAddressBook,
MailboxPlanType,
Archiving,
EnableArchiving
EnableArchiving,
ArchiveSizeMB,
ArchiveWarningPct
FROM
ExchangeMailboxPlans
WHERE
@ -3741,7 +3767,9 @@ SELECT
LitigationHoldUrl,
LitigationHoldMsg,
Archiving,
EnableArchiving
EnableArchiving,
ArchiveSizeMB,
ArchiveWarningPct
FROM
ExchangeMailboxPlans
WHERE
@ -3759,6 +3787,13 @@ ALTER TABLE [dbo].[ExchangeAccounts] ADD
END
GO
IF NOT EXISTS(select 1 from sys.columns COLS INNER JOIN sys.objects OBJS ON OBJS.object_id=COLS.object_id and OBJS.type='U' AND OBJS.name='ExchangeAccounts' AND COLS.name='EnableArchiving')
BEGIN
ALTER TABLE [dbo].[ExchangeAccounts] ADD
[EnableArchiving] [bit] NULL
END
GO
ALTER PROCEDURE [dbo].[GetExchangeAccount]
(
@ItemID int,
@ -3781,7 +3816,8 @@ SELECT
E.SubscriberNumber,
E.UserPrincipalName,
E.ArchivingMailboxPlanId,
AP.MailboxPlan as 'ArchivingMailboxPlan'
AP.MailboxPlan as 'ArchivingMailboxPlan',
E.EnableArchiving
FROM
ExchangeAccounts AS E
LEFT OUTER JOIN ExchangeMailboxPlans AS P ON E.MailboxPlanId = P.MailboxPlanId
@ -3816,7 +3852,8 @@ SELECT
E.SubscriberNumber,
E.UserPrincipalName,
E.ArchivingMailboxPlanId,
AP.MailboxPlan as 'ArchivingMailboxPlan'
AP.MailboxPlan as 'ArchivingMailboxPlan',
E.EnableArchiving
FROM
ExchangeAccounts AS E
LEFT OUTER JOIN ExchangeMailboxPlans AS P ON E.MailboxPlanId = P.MailboxPlanId
@ -3857,7 +3894,8 @@ SELECT
E.SubscriberNumber,
E.UserPrincipalName,
E.ArchivingMailboxPlanId,
AP.MailboxPlan as 'ArchivingMailboxPlan'
AP.MailboxPlan as 'ArchivingMailboxPlan',
E.EnableArchiving
FROM
ExchangeAccounts AS E
LEFT OUTER JOIN ExchangeMailboxPlans AS P ON E.MailboxPlanId = P.MailboxPlanId
@ -3888,7 +3926,8 @@ SELECT
E.SubscriberNumber,
E.UserPrincipalName,
E.ArchivingMailboxPlanId,
AP.MailboxPlan as 'ArchivingMailboxPlan'
AP.MailboxPlan as 'ArchivingMailboxPlan',
E.EnableArchiving
FROM
ExchangeAccounts AS E
LEFT OUTER JOIN ExchangeMailboxPlans AS P ON E.MailboxPlanId = P.MailboxPlanId
@ -3915,7 +3954,8 @@ SELECT
E.SubscriberNumber,
E.UserPrincipalName,
E.ArchivingMailboxPlanId,
AP.MailboxPlan as 'ArchivingMailboxPlan'
AP.MailboxPlan as 'ArchivingMailboxPlan',
E.EnableArchiving
FROM
ExchangeAccounts AS E
LEFT OUTER JOIN ExchangeMailboxPlans AS P ON E.MailboxPlanId = P.MailboxPlanId
@ -4024,13 +4064,15 @@ ALTER PROCEDURE [dbo].[SetExchangeAccountMailboxplan]
(
@AccountID int,
@MailboxPlanId int,
@ArchivingMailboxPlanId int
@ArchivingMailboxPlanId int,
@EnableArchiving bit
)
AS
UPDATE ExchangeAccounts SET
MailboxPlanId = @MailboxPlanId,
ArchivingMailboxPlanId = @ArchivingMailboxPlanId
ArchivingMailboxPlanId = @ArchivingMailboxPlanId,
EnableArchiving = @EnableArchiving
WHERE
AccountID = @AccountID
@ -4052,7 +4094,8 @@ ALTER PROCEDURE [dbo].[UpdateExchangeAccount]
@Password varchar(200),
@MailboxPlanId int,
@ArchivingMailboxPlanId int,
@SubscriberNumber varchar(32)
@SubscriberNumber varchar(32),
@EnableArchiving bit
)
AS
@ -4073,7 +4116,8 @@ UPDATE ExchangeAccounts SET
SamAccountName = @SamAccountName,
MailboxPlanId = @MailboxPlanId,
SubscriberNumber = @SubscriberNumber,
ArchivingMailboxPlanId = @ArchivingMailboxPlanId
ArchivingMailboxPlanId = @ArchivingMailboxPlanId,
EnableArchiving = @EnableArchiving
WHERE
AccountID = @AccountID