首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >CRM 2011使用outlook插件访问webcontext

CRM 2011使用outlook插件访问webcontext
EN

Stack Overflow用户
提问于 2014-10-25 06:16:48
回答 1查看 152关注 0票数 0

我在web上找到了一些插件代码,它们使我能够获得插件中实体的实体ID和对象类型代码。插件在activitypointer上的RetrieveMultiple上触发。这段代码让我可以获得当前正在查看的实体的id和对象代码(它显示了触发插件的活动网格)。

此代码在使用web界面时运行良好。然而,我需要它也在Outlook预览窗格中工作,目前它不能。Outlook预览窗格中的活动网格只显示“发生错误”。下面是插件用来从网页标题中获取详细信息的代码。

代码语言:javascript
复制
    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子网格,而是子网格所在的实际父实体)。

感谢你在这方面的帮助或指导。

EN

回答 1

Stack Overflow用户

发布于 2014-10-26 03:58:05

这可能行得通。返回的每个活动指针都应该是“关于”相同的记录(如果在一个子网格中)。如果你以第一个为例,检查一下regardingobjectid属性,它应该是一个实体引用,它会给你父元素的逻辑名称和它的guid。如果这是可行的,它将适用于所有客户端(至少在理论上)。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26557121

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档