我对此很陌生,如果这是一个愚蠢的问题,请抱歉。
我正在尝试创建Office外接程序。
我想要做的是获取您正在开始的会议的开始时间,并将其放入HTML div中。 这是我的.js:
Office.onReady().then(function() {
var item = Office.context.mailbox.item;
getStartTime();
});
function getStartTime() {
var timeText = document.getElementById("time");
timeText.innerHTML = item.start.getAsync();
}
如果我将“ item.start.getAsync()”更改为字符串,则一切正常。
如果将其更改为“ item.start”,则div变为“未定义”
谁能指出我正确的方向?我什至试图以正确的方式做到这一点吗?
谢谢
答案 0 :(得分:1)
正如评论<?
// function to convert string and print
function convertString ($date)
{
// convert date and time to seconds
$sec = strtotime($date);
// convert seconds into a specific format
$date = date("Y-m-d H:i", $sec);
// append seconds to the date and time
$date = $date . ":00";
// print final date and time
echo $date;
}
// Driver code
$date = "06/12/2014 04:13 PM";
convertString($date);
?>
中的@PatrickHund一样,它具有异步性质,您需要使用回调函数的结果。如何通过链接Get or set the time when composing an appointment in Outlook的完整示例。您的代码可能看起来像...
getAsync