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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

'fileExists' is obsolete: ''WinAPI has been deprecated and should not be used.''. I have to remove this waring( Best practice issue) ?

(0) ShareShare
ReportReport
Posted on by 60

16168.Capture.PNG

I have the same question (0)
  • Martin Dráb Profile Picture
    239,507 Most Valuable Professional on at

    You'll remove this warnin by following what it told you - stop using WinAPI class.

    If you want to also know how to redesign your code, you'll need to tell us what your code is supposed to do.

  • baltistan115 Profile Picture
    60 on at

    Thank You Martin for your quick response !

    As "WinAPI" is for Ax2012, now I am using D365 finance and operation. When i search for alternate of this method in D365 finance and operation. what I found is

    "Migration notes

     Remove usage of these APIs from your code. Replace file access APIs, such as WinAPI::getTempPath, WinAPI::fileExists,

     with the new file APIs."

    Is there any alternate class of "WinAPI" in D365 finance and operation ?

  • Martin Dráb Profile Picture
    239,507 Most Valuable Professional on at

    As I said, it all depends on what you're trying to achieve with your code.

    If you're trying to access files on users' machines, forget it - it's not possible. The web server running somewhere in Azure can't read files on machines that merely send HTTP requests to it.

    If you want to read files on AOS, it also doesn't make good sense either. You could use an Azure storage instead, which will be shared by all AOS instances.

    There is really no way to design a solution without first understanding what it should do.

  • baltistan115 Profile Picture
    60 on at

    Ok, I understand what you want to say !

    I think its just checking weather the file exist or not.

    Actually I am removing the Best practice issues of already existing projects and also the project is migrated from AX2012 to D365 FO.

    code1.PNG

    As Microsoft describe 

    martin.PNG

    My question is "Is there any alter class of WinAPI for D365 FO ?"

  • Martin Dráb Profile Picture
    239,507 Most Valuable Professional on at

    That's a wrong question. You shouldn't try to alter WinAPI class. What you should do is rethinging the solution to work in F&O. This is not just about removing best practice violations.

    In most cases, you shouldn't work with the file system at all, therefore you need to change the whole architecture, not just replacing a single method call.

    If you have no idea what the code is doing, you aren't in a position to upgrade it. Your next step must be learning what the code is for.

    The code above is deleting a file and checking if the file exists before trying to do it. Ask yourself what file it is. Which process it is related to? On which computer do you expect it exist? Does it really makes sense in F&O?

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 664

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 615 Super User 2026 Season 1

#3
CP04-islander Profile Picture

CP04-islander 550

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans