Page 1 of 1

Call to SPOpenFile does not seem to check csUserID passed in

Posted: Fri Aug 25, 2017 6:48 pm
by at2k21
When making calls to SPOpenFile it always succeeds as long as csFileID is valid regardless of the value of csUserID. What is the purpose of the csUserID parameter? Is it really needed?

In calls to SPGetPromptFilesDirectory chUserID parameter is checked and only seems to work for the value "Default". Where can I look to get a list of valid values for this parameter?

Re: Call to SPOpenFile does not seem to check csUserID passed in

Posted: Mon Aug 28, 2017 8:57 am
by Gil McNeill
For SPOpenFile...the user ID is used in the data file locking mechanism. So...if your app using the API has an order open, and a ProForm user tries to open the same order, they will receive a message indicating the the order is already open...and who has it open.

It may be helpful to add (via SPAdmin) a user ID that you use for API calls. For example...add a user called "APIUser". In the above scenario, the ProForm user would be able to tell that the order is open by the API application. The warning they would receive would say something like "The file can only be opened read only because it is currently opened by APIUser"

As far as SPGetPromptFilesDirectory...the user ID is used to get the prompts directory for that user. This is part of the SPAdmin setting for that user. Normally the prompts directory is the same for all users, but sometimes this is used to give a user a set of custom prompts.

Again...you may want to set up the APIUser in SPAdmin and set it up however it makes sense...and then pass in this user ID for all API calls.