如何使用X++在Microsoft Dynamics AX 2009中获取PDF文件的创建日期?
以及如何打开PDF文件的按钮点击?
没有内置函数可以做到这一点,但您可以询问Windows。
WinAPi getFileTime函数返回一个文件时间结构。然而,参数和返回值的接口都有点困难(查看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:UserszjbkMy DocumentsActionTool_SysFlushDictionaryServer.xpo")));
}
使用默认查看器打开PDF或任何文件:
WinAPI::ShellExecute(@"C:test.pdf");