在mscrm中,如果想查询一条记录共享给了哪些人,需要用到PrincipalObjectAccess 表,sql如下:
select u.FullName,a.RC_name,sup.SystemUserId,POA.ObjectId from PrincipalObjectAccess POA inner
join SystemUserPrincipals sup on POA.PrincipalId = sup.PrincipalId
inner join SystemUserBase u
on sup.SystemUserId=u.SystemUserId
inner join Rc_importList a
on a.Rc_importListId=POA.ObjectId
where POA.objecttypecode=10004
AND ((POA.AccessRightsMask | POA.InheritedAccessRightsMask) & 1)=1
and POA.ObjectId='790C63D9-56A0-E311-8A54-00188B421B2B'
附表结构