Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 general forum

CRM appointment doesn't sync to Outlook when created by Plugin/Console

Posted on by 5

Hello there

Im facing the following problem:
I create appointments through C# Code Plugin or Console. These appointments do not sync to outlook.
If the user creates an appointment manually it works and it syncs to the Outlook calender.

I already checked the Outlook sync filter. I even built the Outlook sync filter query in the advanced find and found my appointment, which does not sync. 
In the C# Code I set all the required fields with valid values. Looks like this:

pastedimage1565794641731v2.png

Does anyone have an idea why the crm does not want to sync my appointments?

  • Simone Colombo Profile Picture
    Simone Colombo 60 on at
    RE: CRM appointment doesn't sync to Outlook when created by Plugin/Console

    Yeah, I had already solved it a few months ago but had not updated my answer. Anyway thank you very much for the reply.

    Simone

  • MHeidweiller Profile Picture
    MHeidweiller 5 on at
    RE: CRM appointment doesn't sync to Outlook when created by Plugin/Console

    You are missing the party lists for Organizer and Required. These are needed for the for the sync with Outlook. Here is the snippet of code:

    public static Guid CreateAppointment(IOrganizationService service, ITracingService tracingService, EntityReference regarding, string subject, DateTime startDate, DateTime endDate, int duration, EntityReference required, string memo)
    {
        var appointment = new Entity("appointment");
    
        appointment["subject"] = subject;
        appointment["scheduledstart"] = startDate;
        appointment["scheduledend"] = endDate;
        appointment["scheduleddurationminutes"] = duration;
    
        var requiredParty = new Entity("activityparty");
        requiredParty["partyid"] = required;
    
        appointment["requiredattendees"] = new Entity[] { requiredParty };
        appointment["organizer"] = new Entity[] { requiredParty };
        appointment["ownerid"] = required;
        appointment["description"] = memo;
    
        appointment["regardingobjectid"] = regarding;
    
        var appointmentId = service.Create(appointment);
    
        tracingService.Trace("Created appointment with Guid: {0}", appointmentId);
    
        service.Execute(new SetStateRequest
        {
            EntityMoniker = new EntityReference("appointment", appointmentId),
            State = new OptionSetValue(3),
            Status = new OptionSetValue(5)
        });
    
        return appointmentId;
    }

    Inspiration for this from:

    Arpit's Dynamics 365 Blog: Party List Fields in Dynamics 365 (arpitmscrmhunt.blogspot.com)
    Change the Status of Record using Plugin in Dynamics CRM 2011 | Magnetism Solutions | NZ (Auckland, Wellington, Christchurch and Dunedin)
    https://docs.microsoft.com/en-us/power-platform/admin/troubleshooting-monitoring-server-side-synchronization#appointments-cant-be-synchronized

    Hopefully this resolves somebodies issue when finding this thread.

  • Simone Colombo Profile Picture
    Simone Colombo 60 on at
    RE: CRM appointment doesn't sync to Outlook when created by Plugin/Console

    I also have this problem. Someone can help us?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans