[英]Save Outlook appointment created from a template to non default calendar
I open a Outlook Meeting template and want to associate the appointment created to a non default calendar in Outlook.我打开 Outlook 会议模板,并希望将创建的约会关联到 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. 这种方法将 html 存储在 Excel 单元格中。
Application.CreateItemFromTemplate
function takes a second (optional) parameter - MAPIFolder
where the appointment must be created. Application.CreateItemFromTemplate
函数采用第二个(可选)参数 - 必须在其中创建约会的MAPIFolder
。
Your script must initialize the oFolder
variable and pass it to CreateItemFromTemplate
.您的脚本必须初始化oFolder
变量并将其传递给CreateItemFromTemplate
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.