first, you need to find the shares that are set on the system
this sql script will list all account shares :
( by mitch milans with permission from Satoshi Kawamura http://blogs.infinite-x.net/2006/12/04/finding-crm-accounts-that-have-been-shared/) :
select
ChangedOn 'Shared on',
name 'Account Name',
fullname 'Share Name',
owneridname 'Account Owner', 'User' 'Type'
from
PrincipalObjectAccess,
FilteredAccount,
FilteredSystemUser
where
PrincipalObjectAccess.ObjectTypeCode = 1
and PrincipalObjectAccess.ObjectId = FilteredAccount.accountid
and PrincipalObjectAccess.PrincipalId = FilteredSystemUser.systemuserid
union
select
ChangedOn 'Shared On',
FilteredAccount.name 'Share Name',
FilteredTeam.name,
owneridname 'Account Owner', 'Team' 'Type'
from
PrincipalObjectAccess,
FilteredAccount,
FilteredTeam
where
PrincipalObjectAccess.ObjectTypeCode = 1
and PrincipalObjectAccess.ObjectId = FilteredAccount.accountid
and PrincipalObjectAccess.PrincipalId = FilteredTeam.teamid
order by name
set the ObjectTypeCode and FilteredEntity accordingly.
To remove the share, it may be simplest to delete the record, but seeminlgy better option will be to let the deletion service do the job after marking the records for deletion, this will mark records sharing account entity:
( http://blog.crmbuzz.net/archive/2007/05/07.aspx by Abe Saldana )
SELECT top 500000 *
into #TempPOA
FROM PrincipalObjectAccess (nolock)
where AccessRightsMask = 0 and
InheritedAccessRightsMask > 0 and
PrincipalObjectAccess.ObjectTypeCode = 1
update PrincipalObjectAccess
set InheritedAccessRightsMask = 0
where objectid in (Select #tempPOA.objectid from #tempPOA)
drop table #TempPOA
Aftr that, you need to execute the deletion service.
Saturday, December 20, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment