locked
Plugin for CRM 2011 and Outlook Client RRS feed

  • Question

  • Hello,

    I have created a plugin on Pre - Create/Update message of the Appointment Entity, that checks if any of the Required Attendees are SystemUsers and adds them to another text field. It is working fine when I tried it in the Web client, but when the Appointment is created via the Outlook client (from the Calendar), the plugin does not work.

    How can I make it work when the appointments are created through the Outlook Calendar ? 

    Thanks in advance

    Thursday, August 23, 2012 3:19 PM

Answers

  • Is it not hitting the breakpoint at all? It would be good to have tracing enabled in the plugin to know if it's getting called. You could also check the event logs for any errors. Sometimes even restarting outlook helps.

    It could also be that the plugin is not being called at all by outlook, in which case we would have to look further.

    • Marked as answer by dbrmr Friday, August 24, 2012 9:05 AM
    Thursday, August 23, 2012 4:00 PM

All replies

  • Is your outlook client in the offline mode or so? You can try changing the settings in the plugin registration tool by putting checks against the offline and server checkboxes..

    This should be inside the Step window in the plugin reg tool


    • Edited by SwetaGupta Thursday, August 23, 2012 3:25 PM
    Thursday, August 23, 2012 3:23 PM
  • The Outlook client is in Online mode.

    I've looked in the plugin reg tool, checked the both checkboxes. Still doesn't work :(

    Here is the code if it helps, it is registered on Pre-operation for Create and Update:

                    Entity entity = (Entity)context.InputParameters["Target"];

                    if (entity.LogicalName != "appointment" || context.Depth > 1) return;

                    if (entity.Attributes.Contains("new_colleagues"))
                    {
                        entity["new_colleagues"] = "";
                    }
                    else
                    {
                        entity.Attributes.Add("new_colleagues", "");                        
                    }

                    if (entity.Attributes.Contains("requiredattendees"))
                    {
                        List<string> userNamesList = new List<string>();
                        EntityCollection requiredAttendees = entity["requiredattendees"] as EntityCollection;
                        foreach (Entity req in requiredAttendees.Entities)
                        {
                            EntityReference party = req["partyid"] as EntityReference;
                            if (party.LogicalName == "systemuser")
                            {
                                userNamesList.Add(party.Name);
                            }
                        }
                        string userNames = string.Join(", ", userNamesList.ToArray());
                        entity["new_colleagues"] = userNames;
                    }

    Thursday, August 23, 2012 3:31 PM
  • Ok :( Could you debug the plugin and see if outlook actually calls it or maybe fails at some point in the code?


    • Edited by SwetaGupta Thursday, August 23, 2012 3:43 PM
    Thursday, August 23, 2012 3:42 PM
  • I've debuged it several times, and I think that outlook doesn't call it. I am debuggin by attaching to w3wp.exe process.
    Thursday, August 23, 2012 3:48 PM
  • Is it not hitting the breakpoint at all? It would be good to have tracing enabled in the plugin to know if it's getting called. You could also check the event logs for any errors. Sometimes even restarting outlook helps.

    It could also be that the plugin is not being called at all by outlook, in which case we would have to look further.

    • Marked as answer by dbrmr Friday, August 24, 2012 9:05 AM
    Thursday, August 23, 2012 4:00 PM
  • After I managed to debug the plugin properly, I found out that when the Appointment is created via IE the code up there is working fine, but when the Appointment is created via Outlook client - inside the foreach loop, the party.Name is null, instead of this code I Retrieve the systemuser.fullname and the code is working always.

    Thank you for your help.

    Friday, August 24, 2012 9:03 AM