我在网上找到了一些插件代码,使我能够获得插件中实体的实体ID和对象类型代码。该插件在activitypointer上的RetrieveMultiple上触发。代码让我获取当前正在查看的实体的id和目标代码(显示触发插件的活动网格)。
使用Web界面时,此代码可以正常工作。但是,我需要它也可以在Outlook预览窗格中工作,目前它没有。 Outlook预览窗格中的活动网格只显示"发生错误"。下面是插件用于从Web标题中获取详细信息的代码。
internal static Dictionary<string, string> GetHeaderFields(HttpContext webcontext, string objectTypeCode, string objectId)
{
Dictionary<string, string> fields = new Dictionary<string, string>();
string callerentitytype = null;
string callerentityidstring = null;
try
{
// Activities Navigation Pane
if (new List<string>(webcontext.Request.Params.AllKeys).Contains("oType"))
{
callerentitytype = webcontext.Request.Params["oType"];
callerentityidstring = webcontext.Request.Params["oId"];
}
// Activities Sub Grid
else
{
string requeststring = webcontext.Request.UrlReferrer.Query;
requeststring = requeststring.Substring(1);
string[] parts = requeststring.Split(new string[] { "=", "&" }, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < parts.Length - 1; i++)
if (parts[i].ToLower() == "otype" || parts[i].ToLower() == "etc")
callerentitytype = parts[i + 1];
else if (parts[i].ToLower() == "oid" || parts[i].ToLower() == "id")
callerentityidstring = parts[i + 1];
}
fields.Add(objectTypeCode, callerentitytype);
fields.Add(objectId, callerentityidstring);
}
catch (Exception ex)
{
throw new Plugin.LoggableException(string.Format("Failed to obtain header information; {0}", ex.Message), ex.InnerException);
}
return fields;
}
原因是webcontext.Request.UrlReferrer为NULL。有没有其他地方我可以得到这个&#39;呼叫&#39;实体? (不是触发插件的活动子网格,而是子网格所在的实际父实体)。
感谢您提供任何帮助或指导。
答案 0 :(得分:0)
此可能有效。返回的每个活动指针都应该是&#34;关于&#34;相同的记录(如果在子网格中)。如果你说第一个并检查aboutobjectid属性,那应该是一个实体引用,它将为你提供父代的逻辑名称和它的guid。如果这样可行,它将适用于所有客户(理论上无论如何)。