检索另一个用户视图的fetchXml属性

时间:2014-05-02 15:50:23

标签: c# .net dynamics-crm-2011

我正在尝试检索个人视图的fetchxml(由另一个用户拥有而不是向组织服务发出请求的用户):

        public static UserQuery RetrieveUserQuery(string userQueryName)
        {

            string xmlFetch = @"<fetch distinct='false' mapping='logical' output-format='xml-platform' version='1.0'> 
                                    <entity name='userquery'>
                                        <attribute name='fetchxml'/>
                                        <filter type='and'>
                                            <condition attribute='name' value='{0}' operator='eq'/>
                                        </filter>
                                    </entity>
                                </fetch>";

            xmlFetch = string.Format(xmlFetch, userQueryName);

            try
            {
                var ent = Helper.XrmProxy.RetrieveMultiple(new FetchExpression(xmlFetch));

                if (ent.Entities.Count() == 0)
                    return null;
                if (ent.Entities.Count() > 1)
                    throw new Exception("More than one view with same name found!");

                return ent.Entities[0].ToEntity<UserQuery>();

            }
            catch
            {
                throw;
            }
        }

但似乎我们只能通过在组织服务上使用与拥有视图的凭据相同的凭据来实现此目的。

这是真的吗?有旁路吗?

此方法始终返回null(检索到0个实体)。组织服务上使用的凭据是系统管理员,因此我认为即使它没有共享,我也可以访问它...

1 个答案:

答案 0 :(得分:0)

除非与其他用户共享,否则个人视图仅归用户所有。甚至系统管理员也无法访问其他用户的个人视图