Wednesday, October 9, 2013

Mule - Sharepoint Connector

I have been working a little with Mule ESB - Enterprise Edition. I needed to get a Sharepoint (duh - Imperial Star Battlecruisers), so I was happy to see the Mule Sharepoint Connector. The Connector implementents NTLMv2, so it can talk to newer Sharepoint versions. After getting past the first small gotchas (remember slash af URL, URL without the '_vti_bin' stuff, ListName is the list name & view name is the GUID) - the list was received as an SOAP Java object - GetListItemsResult.

Now that was perfect except the M$ SOAP service limits the result to 100 rows, if you do not specify a rowlimit, and i could not get that to work on the Sharepoint Connector component, so i 'just' made a java component from trial and error reverse engineering the component using the Java classes:

import org.mule.modules.sharepoint.SharepointConnector;
import org.mule.modules.sharepoint.microsoft.lists.GetListItems;
import org.mule.modules.sharepoint.microsoft.lists.GetListItemsResponse.GetListItemsResult;

....
SharepointConnector sc = new org.mule.modules.sharepoint.SharepointConnector();
             sc.connect("DOMAIN\\USERNAME", "PASSWORD", "URL_W_SLASH");

org.mule.modules.sharepoint.microsoft.lists.GetListItems request =
            new org.mule.modules.sharepoint.microsoft.lists.GetListItems();
request.setListName("LISTNAME");
request.setRowLimit("" + 0);
request.setViewName("VIEW_GUID");
GetListItemsResult result = sc.listGetListItems(request);


Replace UPPERCASE names with real values. You can use the GetListAndView to get the GUIDs

Other ways of getting this to work is http://dmdaa.wordpress.com/2012/10/10/ntlm-v2-support-for-java-web-service-clients-wsimport-or-axis2-stubs-for-sharepoint-server/

However I did not succeed with that approach.