web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

invalid attempt to cal winapi.fileexists runnning in CIL on client

(0) ShareShare
ReportReport
Posted on by 4,359

Hi everyone,

I am trying to save notepad file via batch process in AX 2012. I am getting "invalid attempt to cal winapi.fileexists runnning in CIL on client" error when the batch process executes. I got the error that batch doesnt support client specific process. But may i know the solution to resolve this issue.

Thanks & Regards

Arpit Chavhan

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    skaue Profile Picture
    Moderator on at
    RE: invalid attempt to cal winapi.fileexists runnning in CIL on client

    Arpit,

    The WinApi class is for processes running on clients. Consider adding a test in your code to detect if the current context is running server side and if so use WinApiServer, or better yet rewrite your code to use .Net completely to check for existence of files.

    Here are some examples of file handling using .Net

    colinmitchell.net/.../file-handling

    Best of luck!

  • dolee Profile Picture
    11,279 on at
    RE: invalid attempt to cal winapi.fileexists runnning in CIL on client

    Hi,

    I mean setting up a network share that is both accessible by clients and AOS. When setting up the batch job, set the file destination to the network share. Then, use WinAPIServer instead of WinAPI in the code for fileExist check (because WinAPI is set to RunOn client).

    P.S. Or maybe I read your questions incorrectly, all you need is WinAPIServer =)

    Regards,

    Dominic

  • ARPIT CHAVHAN Profile Picture
    4,359 on at
    RE: invalid attempt to cal winapi.fileexists runnning in CIL on client

    Hi Dolee,

    Can you please elaborate. I didnt get it actually.

  • dolee Profile Picture
    11,279 on at
    RE: invalid attempt to cal winapi.fileexists runnning in CIL on client

    Is using a network share a possible?

    Regards,

    Dominic

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Syed Haris Shah Profile Picture

Syed Haris Shah 9

#2
Mea_ Profile Picture

Mea_ 4

#3
Martin Dráb Profile Picture

Martin Dráb 2 Most Valuable Professional

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans