added "memberOf" functionality and bugs fixed
This commit is contained in:
parent
594edf416c
commit
f7fae8fe2f
20 changed files with 1283 additions and 35 deletions
|
@ -1967,3 +1967,69 @@ GO
|
|||
|
||||
|
||||
|
||||
|
||||
ALTER PROCEDURE [dbo].[SearchExchangeAccounts]
|
||||
(
|
||||
@ActorID int,
|
||||
@ItemID int,
|
||||
@IncludeMailboxes bit,
|
||||
@IncludeContacts bit,
|
||||
@IncludeDistributionLists bit,
|
||||
@IncludeRooms bit,
|
||||
@IncludeEquipment bit,
|
||||
@FilterColumn nvarchar(50) = '',
|
||||
@FilterValue nvarchar(50) = '',
|
||||
@SortColumn nvarchar(50)
|
||||
)
|
||||
AS
|
||||
DECLARE @PackageID int
|
||||
SELECT @PackageID = PackageID FROM ServiceItems
|
||||
WHERE ItemID = @ItemID
|
||||
|
||||
-- check rights
|
||||
IF dbo.CheckActorPackageRights(@ActorID, @PackageID) = 0
|
||||
RAISERROR('You are not allowed to access this package', 16, 1)
|
||||
|
||||
-- start
|
||||
DECLARE @condition nvarchar(700)
|
||||
SET @condition = '
|
||||
((@IncludeMailboxes = 1 AND EA.AccountType = 1)
|
||||
OR (@IncludeContacts = 1 AND EA.AccountType = 2)
|
||||
OR (@IncludeDistributionLists = 1 AND EA.AccountType = 3)
|
||||
OR (@IncludeRooms = 1 AND EA.AccountType = 5)
|
||||
OR (@IncludeEquipment = 1 AND EA.AccountType = 6)
|
||||
OR (@IncludeEquipment = 0 AND @IncludeContacts = 0 AND @IncludeDistributionLists = 0 AND @IncludeRooms = 0 AND @IncludeEquipment = 0 AND EA.AccountType = 8))
|
||||
AND EA.ItemID = @ItemID
|
||||
'
|
||||
|
||||
IF @FilterColumn <> '' AND @FilterColumn IS NOT NULL
|
||||
AND @FilterValue <> '' AND @FilterValue IS NOT NULL
|
||||
SET @condition = @condition + ' AND ' + @FilterColumn + ' LIKE ''' + @FilterValue + ''''
|
||||
|
||||
IF @SortColumn IS NULL OR @SortColumn = ''
|
||||
SET @SortColumn = 'EA.DisplayName ASC'
|
||||
|
||||
DECLARE @sql nvarchar(3500)
|
||||
|
||||
set @sql = '
|
||||
SELECT
|
||||
EA.AccountID,
|
||||
EA.ItemID,
|
||||
EA.AccountType,
|
||||
EA.AccountName,
|
||||
EA.DisplayName,
|
||||
EA.PrimaryEmailAddress,
|
||||
EA.MailEnabledPublicFolder,
|
||||
EA.SubscriberNumber,
|
||||
EA.UserPrincipalName
|
||||
FROM ExchangeAccounts AS EA
|
||||
WHERE ' + @condition
|
||||
|
||||
print @sql
|
||||
|
||||
exec sp_executesql @sql, N'@ItemID int, @IncludeMailboxes int, @IncludeContacts int,
|
||||
@IncludeDistributionLists int, @IncludeRooms bit, @IncludeEquipment bit',
|
||||
@ItemID, @IncludeMailboxes, @IncludeContacts, @IncludeDistributionLists, @IncludeRooms, @IncludeEquipment
|
||||
|
||||
RETURN
|
||||
GO
|
Loading…
Add table
Add a link
Reference in a new issue