Fix HO users popup and Organizations.SearchAccounts now populates a IsLyncUser property in OrganizationUser.
This commit is contained in:
parent
8729a7f5a9
commit
ad092e2fc6
1 changed files with 67 additions and 0 deletions
|
@ -9267,3 +9267,70 @@ END
|
||||||
DROP TABLE #TempLyncUsers
|
DROP TABLE #TempLyncUsers
|
||||||
|
|
||||||
GO
|
GO
|
||||||
|
|
||||||
|
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'SearchOrganizationAccounts')
|
||||||
|
DROP PROCEDURE SearchOrganizationAccounts
|
||||||
|
GO
|
||||||
|
SET ANSI_NULLS ON
|
||||||
|
GO
|
||||||
|
SET QUOTED_IDENTIFIER OFF
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE PROCEDURE [dbo].[SearchOrganizationAccounts]
|
||||||
|
(
|
||||||
|
@ActorID int,
|
||||||
|
@ItemID int,
|
||||||
|
@FilterColumn nvarchar(50) = '',
|
||||||
|
@FilterValue nvarchar(50) = '',
|
||||||
|
@SortColumn nvarchar(50),
|
||||||
|
@IncludeMailboxes bit
|
||||||
|
)
|
||||||
|
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 = '
|
||||||
|
(EA.AccountType = 7 OR (EA.AccountType = 1 AND @IncludeMailboxes = 1) )
|
||||||
|
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.SubscriberNumber,
|
||||||
|
EA.UserPrincipalName,
|
||||||
|
(CASE WHEN LU.AccountID IS NULL THEN ''false'' ELSE ''true'' END) as IsLyncUser
|
||||||
|
FROM ExchangeAccounts AS EA
|
||||||
|
LEFT JOIN LyncUsers AS LU
|
||||||
|
ON LU.AccountID = EA.AccountID
|
||||||
|
WHERE ' + @condition
|
||||||
|
|
||||||
|
print @sql
|
||||||
|
|
||||||
|
exec sp_executesql @sql, N'@ItemID int, @IncludeMailboxes bit',
|
||||||
|
@ItemID, @IncludeMailboxes
|
||||||
|
|
||||||
|
RETURN
|
||||||
|
|
||||||
|
GO
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue