none
共享事宜 RRS feed

答案

  • 假如你用的是on-premise版本, 你可以花点时间研究 PrincipalObjectAccess 这个表。 (切记不要在SQL修改)

      [PrincipalId]: 共享记录的用户或团队GUID
      [ObjectId]:共享记录的GUID
      [ObjectTypeCode] :共享记录所属的实体 (如account = 1, contact = 2,opportunity = 3......)
      [AccessRightsMask] :共享的权限(Read = 1, Write = 2, Append = 4, AppendTo = 16, Create = 16,Delete = 65536,Share = 262144, Assign = 524288, 所以如果=3,权限为read/write)

    有了这些资料,剩下来的就是用sql联接语句,做成一个报表(可以考虑使用参数),这里就不详述了。

    假如你用的是Online版本, 可以用fetchxml, 原理是一样的, 下面这连接有例子(这个例子是查找所有与某用户共享的opportunity)

    http://social.microsoft.com/Forums/en-US/crmdevelopment/thread/6f017ae4-c376-4b47-b14d-6b81170a4682

    string fetchxml = @"

    <fetch mapping='logical'>
     <entity name='principalobjectaccess'> 
     <filter type='and'>
     <condition attribute = 'objecttypecode' operator='eq' value='3'/>
     <condition attribute = 'principalid' operator='eq' value='A0D54C73-B634-DE11-9B74-0003FF18DEBC'/> //用户GUID
     </filter>
     <link-entity name='opportunity' from='opportunityid' to='objectid'>
     <attribute name='name'/>
     </link-entity>
     </entity>
    </fetch>";

    String result = CrmService.Fetch(fetchxml); 




    2012年8月31日 19:11

全部回复

  • 假如你用的是on-premise版本, 你可以花点时间研究 PrincipalObjectAccess 这个表。 (切记不要在SQL修改)

      [PrincipalId]: 共享记录的用户或团队GUID
      [ObjectId]:共享记录的GUID
      [ObjectTypeCode] :共享记录所属的实体 (如account = 1, contact = 2,opportunity = 3......)
      [AccessRightsMask] :共享的权限(Read = 1, Write = 2, Append = 4, AppendTo = 16, Create = 16,Delete = 65536,Share = 262144, Assign = 524288, 所以如果=3,权限为read/write)

    有了这些资料,剩下来的就是用sql联接语句,做成一个报表(可以考虑使用参数),这里就不详述了。

    假如你用的是Online版本, 可以用fetchxml, 原理是一样的, 下面这连接有例子(这个例子是查找所有与某用户共享的opportunity)

    http://social.microsoft.com/Forums/en-US/crmdevelopment/thread/6f017ae4-c376-4b47-b14d-6b81170a4682

    string fetchxml = @"

    <fetch mapping='logical'>
     <entity name='principalobjectaccess'> 
     <filter type='and'>
     <condition attribute = 'objecttypecode' operator='eq' value='3'/>
     <condition attribute = 'principalid' operator='eq' value='A0D54C73-B634-DE11-9B74-0003FF18DEBC'/> //用户GUID
     </filter>
     <link-entity name='opportunity' from='opportunityid' to='objectid'>
     <attribute name='name'/>
     </link-entity>
     </entity>
    </fetch>";

    String result = CrmService.Fetch(fetchxml); 




    2012年8月31日 19:11
  • 谢谢楼主!

    2012年9月3日 0:58
  • 我的报表设想:从此表中取出account记录的objectID,再从视图中找出所有的相应的客户记录.

    我从account中取出一条已共享的记录的accountid,在PrincipalObjectAccess 中objectid相等的记录居然有三个,不知是为什么。




    2012年9月3日 7:59
  • 我看了三条记录的principalid不同,应是分别共享给三个人的三条记录吧.

    2012年9月3日 9:45