0

I'm trying to add a new calendar exception to a specific resource using CSOM. However, when trying to update the resource, I'm getting a PJClientCallableException: CalendarExceptionConflict, which according to this, seems to occur when there's a conflict in the calendar exceptions.

Here's a piece of my code:

        var creationInfo = new CalendarExceptionCreationInformation();
        creationInfo.Name = "Vacaciones CSOM";

        // Specify (¿optional?) properties.
        creationInfo.Start = DateTime.Today;
        creationInfo.Finish = DateTime.Today.AddDays(5);

        var resourceId = "XXX";
        var resource = projContext.EnterpriseResources.GetById(resourceId);

        projContext.Load(resource);
        projContext.Load(resource.ResourceCalendarExceptions);
        projContext.ExecuteQuery(); 

        // Add the calendar exception to the collection.
        resource.ResourceCalendarExceptions.Add(creationInfo); 

        // Submit the request to update the collection on the server
        projContext.EnterpriseResources.Update();
        projContext.ExecuteQuery(); 

Any advise?

1 Answer 1

0

Fixed it! The problem was there was another Calendar Exception in the period I was trying to create. Hope it helps!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.