将通过模板创建的Outlook约会保存到非默认日历 [英] Save Outlook appointment created from a template to non default calendar
问题描述
我打开一个Outlook Meeting模板,并希望将创建的约会关联到Outlook中的非默认日历.随附的代码将保存到默认日历.
I open a Outlook Meeting template and want to associate the appointment created to a non default calendar in Outlook. The attached code saves to the default calendar.
Sub Whatever()
Dim olApp As Object
Set olApp = GetObject(, "Outlook.Application")
Dim oApt As Outlook.AppointmentItem
Dim myTemplate As Object
Dim ns As Outlook.Namespace
Dim nsOther As Outlook.Recipient
Dim oFolder As Outlook.Folder
Dim template As String
template = "C:\Users\Some User\Meeting.oft"
Set myTemplate = olApp.CreateItemFromTemplate(template)
myTemplate.Recipients.Add ("someuser@contoso.com")
myTemplate.Start = "16/04/2019 10:30"
myTemplate.Display
myTemplate.Send
End Sub
此问题类似,但保存了一次新会议(不是从模板创建的),而是非默认日历.
This question is similar but saves a new meeting, not created from a template, to a non default calendar.
This approach stores the html in an Excel cell.
推荐答案
Application.CreateItemFromTemplate
函数采用第二个(可选)参数-MAPIFolder
必须在其中创建约会.
Application.CreateItemFromTemplate
function takes a second (optional) parameter - MAPIFolder
where the appointment must be created.
您的脚本必须初始化oFolder
变量并将其传递给CreateItemFromTemplate
.
Your script must initialize the oFolder
variable and pass it to CreateItemFromTemplate
.
这篇关于将通过模板创建的Outlook约会保存到非默认日历的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!