locked
how can i get participant of appoinment in silverlight mscrm 2011 RRS feed

  • Question

  • Dear All;

    how can i get participants of a appoinment in silverlight mscrm 2011

    Tuesday, June 5, 2012 11:50 AM

Answers

  • Looks like you are using JS code and .NET together. The XRM Page model only works in JS.

    If you want to do it in .NET, then you would do it like this:
    PS: This is on a specific Appointment, if you want to retrieve all appointments, then you need to do a RetrieveMultipleRequest

    var appointment = proxy.Retrieve(Appointment.EntityLogicalName,new Guid("FC8C427B-26AE-E111-ADAD-000C29CBD80B"),new ColumnSet(true));
                        List<ActivityParty> party = ((Appointment)appointment).RequiredAttendees.ToList<ActivityParty>();
                        foreach (ActivityParty ap in party)
                        {
                            if(ap.PartyId.LogicalName == Contact.EntityLogicalName)
                                Console.WriteLine(string.Format("It's a contact with id {0}",ap.PartyId.Id));
                            else if (ap.PartyId.LogicalName == Account.EntityLogicalName)
                                Console.WriteLine(string.Format("It's an account with id {0}", ap.PartyId.Id));
                        }

    http://mshelp.be/iterating-over-requiredattendees-in-an-appointment-401.htm

    I advise you to have a look at the CRM 2011 SDK http://www.microsoft.com/en-us/download/details.aspx?id=24004


    Wednesday, June 6, 2012 7:10 AM

All replies

  • You retrieve the activityparty of the appointment and display it in a silverlight application.

    Have a look here: http://nishantrana.wordpress.com/2011/05/17/set-organizer-or-working-with-activityparty-in-crm-2011/

    Tuesday, June 5, 2012 12:31 PM
  • Retrive Appointment then you will get the bject of activity party, using that object you can show it on silverlight
    Tuesday, June 5, 2012 12:37 PM
  • Hi Sven;

    i dont want to set  activity party i want to get the requiredattendes field of appointment and then loop through that list to see whether they are accounts of contacts 

    Tuesday, June 5, 2012 12:49 PM
  • requiredattandees is a partylist. Why don't you retrieve that attribute and iterate over that? You can find out by looking at the type to see if it's an account or a contact. Here is some sample JS code http://rajeevpentyala.wordpress.com/2012/04/02/get-and-set-partylist-fields-using-jscript/
    • Proposed as answer by Sven Vanoirbeek Tuesday, June 5, 2012 1:17 PM
    • Unproposed as answer by anwar_addi Tuesday, June 5, 2012 9:44 PM
    Tuesday, June 5, 2012 1:16 PM
  • Thx for your reply i want to do it on silverlight javascript example is not working how can i iterate over the required attendes attribute please help
    Tuesday, June 5, 2012 1:58 PM
  • hi sven ;

    i am using this code but this code is not working not showing the message but i am selecting the contact in the requiredattendees

     var  party = xrm.Page.getAttribute("requiredattendees");
                var partylist = party.getValue();

    if (partylist != null)
                {
                    
                   

                    for (int indxAttendees = 0; indxAttendees <partylist.Length; indxAttendees++) 
    {

        if (partylist[indxAttendees].entityType == "contact")
        {

        MessageBox.Show("contact");



    }

    }

    Tuesday, June 5, 2012 9:48 PM
  • Looks like you are using JS code and .NET together. The XRM Page model only works in JS.

    If you want to do it in .NET, then you would do it like this:
    PS: This is on a specific Appointment, if you want to retrieve all appointments, then you need to do a RetrieveMultipleRequest

    var appointment = proxy.Retrieve(Appointment.EntityLogicalName,new Guid("FC8C427B-26AE-E111-ADAD-000C29CBD80B"),new ColumnSet(true));
                        List<ActivityParty> party = ((Appointment)appointment).RequiredAttendees.ToList<ActivityParty>();
                        foreach (ActivityParty ap in party)
                        {
                            if(ap.PartyId.LogicalName == Contact.EntityLogicalName)
                                Console.WriteLine(string.Format("It's a contact with id {0}",ap.PartyId.Id));
                            else if (ap.PartyId.LogicalName == Account.EntityLogicalName)
                                Console.WriteLine(string.Format("It's an account with id {0}", ap.PartyId.Id));
                        }

    http://mshelp.be/iterating-over-requiredattendees-in-an-appointment-401.htm

    I advise you to have a look at the CRM 2011 SDK http://www.microsoft.com/en-us/download/details.aspx?id=24004


    Wednesday, June 6, 2012 7:10 AM
  • Thanks Alot Sven solved 

    Wednesday, June 6, 2012 8:10 AM