While working on troubleshooting an issue recently for a client, we found a strange issue occur that I have never encountered before and was unable to find any coverage of this topic on the K2 support site which provides a great troubleshooting page for dealing with K2 for SharePoint issues.
One of the first steps I like to start with in troubleshooting K2 issues, is to run the K2 configuration analysis program on the K2 server and verify the K2 for SharePoint setup was completed, which sometimes is a missed step.
The next step was to go through a checklist of pre-requisites for working with a hybrid environment of K2 on-premise and SharePoint Online (O365).
- There must be an SSL cert from a trusted CA installed on the K2 server
- The K2 site or at least the SP15WebService on the K2 server must be accessible from the public Internet in order to communicate with Office 365
- When installing the K2 for SharePoint app for the first time in SharePoint online, it must be run as the O365 tenant admin account
All items were verified, I could reach the K2 site from outside the network, SSL was from a trusted CA and the app registration was successful.
Time to turn on Fiddler for web debugging to see when the '404 not found' error occurs.
When browsing to the SharePoint list which has the K2 application installed and clicking on 'New Item', the expected behavior is to launch a special ASPX page K2 installs as a hidden document library which then loads the K2 form in an iframe from the K2 server. This is what appeared instead:
Looking at the Fiddler trace, I notice the URL reporting the 404 was /sites/IT/K2Pages/NewForm.aspx. This "K2Pages" is a hidden document library created when you deploy the K2 app on the site.
Since this is a hidden library, it's time to fire up the good old SharePoint Designer 2013 and open the site and browse to "All Files". It was here that I noticed an empty K2Pages doc library and another one called K2Pages1 which did contain the missing files.
After removing the empty one and renaming the K2Pages1 to K2Pages, everything worked fine and we can now see the K2 form when creating a new list item:
This is a very rare occurrence and still not sure on the root cause of how it created both, but hopefully this will help you if you ever come across this 404 error when using K2 for SharePoint.