我在web上找到了一些插件代码,它们使我能够获得插件中实体的实体ID和对象类型代码。插件在activitypointer上的RetrieveMultiple上触发。这段代码让我可以获得当前正在查看的实体的id和对象代码(它显示了触发插件的活动网格)。
此代码在使用web界面时运行良好。然而,我需要它也在Outlook预览窗格中工作,目前它不能。Outlook预览窗格中的活动网格只显示“发生错误”。下面是插件用来从网页标题中获取详细信息的代码。
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为空。有没有其他地方我可以得到这个‘调用’实体的信息?(不是触发插件的activity子网格,而是子网格所在的实际父实体)。
感谢你在这方面的帮助或指导。
发布于 2014-10-26 03:58:05
这可能行得通。返回的每个活动指针都应该是“关于”相同的记录(如果在一个子网格中)。如果你以第一个为例,检查一下regardingobjectid属性,它应该是一个实体引用,它会给你父元素的逻辑名称和它的guid。如果这是可行的,它将适用于所有客户端(至少在理论上)。
https://stackoverflow.com/questions/26557121
复制相似问题