如何使用X++在Microsoft Dynamics AX 2009中获取PDF文件的创建日期?如何在按钮点击时打开该PDF文件?
没有内置的函数可以做到这一点,但您可以向Windows询问。
WinAPI getFileTime 函数返回一个 filetime 结构。然而,参数和返回值都有些难以接口化(请查看 AX WinAPI 类中的其他函数)。
更容易的接口是 .Net getCreationTime 方法(在 WinAPI 中定义):
client static UTCDateTime getFileCreationTime(str name)
{
return CLRSystemDateTime2UtcDateTime(System.IO.File::GetCreationTime(name));
}
使用方法如下:
static void Job1(Args _args)
{;
info(strFmt("%1", WinAPi::getFileCreationTime(@"C:\Users\zjbk\My Documents\ActionTool_SysFlushDictionaryServer.xpo")));
}
WinAPI::ShellExecute(@"C:\test.pdf");