0
我試圖獲取個人觀點的做這樣的fetchxml(由其他用戶不是一個發出請求的組織服務擁有):檢索另一個用戶視圖的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實體檢索)。對組織服務使用的憑據是系統管理員,所以我想我應該有機會獲得它,即使它不共享...
你可能審覈userquery創建,更新和刪除郵件的插件代表當前運行的用戶上下文,並保存FetchXml中,你可以查詢一個自定義實體輕鬆。 –
雖然需求發生變化,並且不再需要這樣做,但這很有用,我將使用系統視圖。你可以提出它作爲答案,我會接受它。 –