Symptoms
Currently we experience an issue that some user(s) are not able to upload files to a document library within SharePoint.
If they try to upload Pictures (png and jpg) they receive below error.
==================================================
Error
Failed to initialize the Context: Url: https://tmdinside.tmdfriction.com/sites/iLog Username: Error Details: The remote server returned an error: (401) Unauthorized.
•Type: SourceCode.SmartObjects.Client.SmartObjectException
•Source: SourceCode.SmartObjects.Client
•Method Base
◦Member Type: Method
◦Name: ExecuteScalar
◦Module
■Scope Name: SourceCode.SmartObjects.Client.dll
◦Declaring Type
■Full Name: SourceCode.SmartObjects.Client.SmartObjectClientServer
•Stack Trace: at SourceCode.SmartObjects.Client.SmartObjectClientServer.ExecuteScalar(SmartObject smartObject, DataTable inputTable)at SourceCode.Forms.AppFramework.FormRuntime.SmartObjectExecution(XPathNavigator nav, Boolean outputDependencies, SmartObjectClientServer svr)at SourceCode.Forms.AppFramework.FormRuntime.WorkXmlToApi(String xml)at SourceCode.Forms.Runtime.AJAXCall.ProcessRequest(HttpContext context)
Diagnoses
We determined that these filenames already exist on the server and K2 cannot overwrite these files, we have to give them new names.
Resolution
A solution to this problem would be to append the date time to the filename after uploading the file using the SmartForms file upload control. You can also generate a new GUID for each file. This would ensure that the filenames are unique and will be able to save successfully on the server for later download.