I am trying to integrate SalesForce with Office 365. I am facing some issues trying to get the data from Sharepoint directly from SalesForce. I am using Apex classes to perform REST calls to Office365. But somehow I get the error saying "Arithmetic operation resulted in an overflow."
Below are my steps to fetch data from SP2013
1. Call (POST method) the STS service "/extSTS.srf" to get the BinarySecurityToken
2. Using the BinarySecurityToken get the two cookies FedAuth and rtFA; url used to perform Http POST "_forms/default.aspx?wa=wsignin1.0"
3. Set the cookies in the header and query Sharepoint using REST _api/web/lists/GetByTitle(\'ListName\')/items
Has anyone come across similar issue? Is there any better way to integrate (apart from using 3rd party software). Let me know if you require more details or things are not clear.