A few day ago I shared a code about to document attachment.
This code works fine at client side, but in runbatchjob (batch process) run at server side It threw following error.
“Invalid attempt to call DocuActionArchive.Add running in CIL on the client.”
This is because in Add method winapi is used. This winapi written for running at client side.
I solve this problem by following steps.
- Duplicate the DocuActionArchive and rename the new classes as clsDocuActionArchieve
- Change the class run at client to run at server.
- Inside add method replace winapi to WinAPIServer. There are three places where you have to replace winapi to wimapiserver.
- Comment the wimapi::getOpenFileName it did not exists in winserverapi.
- Wimapi::fileSize to winserverapi::fileSize
- Wimapi::copyFile to winserverapi::copyfile.
Compile the code and use the new class instead of DocuActionArchive. The code will work at server side.