SharePoint Online中PowerPoint的Last Save time属性不更新的原因及解决办法
问题背景
我们需要判断用户是否在PowerPoint中编辑了已打开的演示文稿,方法是记录打开时的初始Last save time,并与当前的Last save time对比,若两者不同则认为文稿已被编辑。
获取Last save time的代码实现
C#(VSTO插件)实现
public static DateTime? GetPresentationLastSaveTime(Presentation presentation) { var saved = presentation.Saved; DateTime? result = null; if (presentation.Path.IsEmpty()) { result = null; return result; } if (presentation.BuiltInDocumentProperties is DocumentProperties properties) result = DateTime.Parse(properties["Last save time"].Value.ToString()); return result; } }
VBA实现
Sub ShowLastSaveTime() MsgBox (Application.ActivePresentation.BuiltInDocumentProperties("Last save time")) End Sub
遇到的问题
存储在SharePoint Online中的普通演示文稿(非宏启用格式),无论手动保存还是自动保存,Last save time属性均不会更新。
验证细节
- 当PowerPoint文件存储在Windows本地文件系统中时,Last save time属性显示的时间是正确的。
- 无需代码即可复现该问题,步骤如下:
- 创建无宏的PowerPoint演示文稿
- 将演示文稿保存到SharePoint Online
- 通过「文件>信息>属性>上次修改日期」查看Last save time
- 等待一分钟(该属性以整分钟显示)
- 对演示文稿进行修改
- 保存更改(或启用自动Save让PowerPoint自动保存)
- 再次在「文件>信息>属性」中查看上次修改日期
执行后可发现上次修改日期仍为原时间。
- 当PowerPoint文件以宏启用格式(
.pptm扩展名)存储在SharePoint Online中时,Last Save time会显示正确的更新后时间,但需注意:宏启用文件无法使用自动保存功能,必须由用户手动保存。
疑问
- 为何存储在SharePoint Online中的普通PowerPoint演示文稿的Last Save Time属性不会更新?
- 是否有办法获取正确的Last saved time?
内容的提问来源于stack exchange,提问作者Robin Bouwmeester
相关产品推荐
相关产品推荐

