Subject: bug#22823: 25.0.50; Excorporate 0.7: incorrect number of parameters to EWS FindItem

From: Thomas Fitzsimmons <[email-masked]>
Date: Fri, 26 Feb 2016 20:39:02 -0500

Hi Aaron,

Aaron Jacobs <[email-masked]> writes:

> This seems to be a bug in the `excorporate' package, version 0.7 as
> released yesterday on GNU ELPA I believe. The author has indicated that
> bugs should be reported using `M-x report-emacs-bug' (see release blog
> post at https://www.fitzsim.org/blog/?p=313), and so here one is:
>
> I have been unable to retrieve calendar events from our Exchange server.
> The relevant *fsm-debug* output for the event is as follows:
>
> Fri Feb 26 16:45:45 2016: exco--fsm [redacted] server version is
> Exchange2010_SP1
> Fri Feb 26 16:47:36 2016: Sent "FindItem" to exco--fsm in state :retrieving-data
> Fri Feb 26 16:47:36 2016: Error in exco--fsm/:retrieving-data: Wrong
> number of parameters for FindItem: expected 5, got 6
>
> This is my first time using the package. Autodiscovery was successful in
> my case, as evidenced by the successful retrieval of the server version.
>
> Any advice on this matter would be appreciated.

Thanks for the report.  Can you try this patch (untested)?

Thanks,
Thomas

--- ./excorporate.el~
+++ ./excorporate.el
@@ -706,11 +706,14 @@ (defun exco-get-meetings-for-day (identifier month day year callback)
 	(ParentFolderIds
 	 (DistinguishedFolderId (Id . "calendar"))))
        ;; Empty arguments.
-       ,@(let ((server-major-version
-		(string-to-number
-		 (substring (exco-server-version identifier) 8 12))))
+       ,@(let* ((server-version (exco-server-version identifier))
+		(server-major-version (string-to-number
+				       (substring server-version 8 12))))
 	   (cond
-	    ((<= server-major-version 2007)
+	    ((or (<= server-major-version 2007)
+		 ;; The FindItem argument count changed between
+		 ;; Exchange2010_SP1 and Exchange2010_SP2.
+		 (equal server-version "Exchange2010_SP1"))
 	     '(nil nil nil nil))
 	    ((< server-major-version 2013)
 	     '(nil nil nil nil nil))