Skip to main content

Notifications

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

  • 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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Leaderboard > Microsoft Dynamics AX (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 100 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 48

#3
Zain Mehmood Profile Picture

Zain Mehmood 6 Moderator

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans