ReferenceError:ConferenceDataService未定义 [英] ReferenceError: ConferenceDataService is not defined
问题描述
我正在尝试开发类似于缩放会议的Google日历插件.
I am trying to develop google calendar add-on like zoom meeting.
在appsscript.json文件中,下面的代码在那里.
In appsscript.json file, below code is there.
"calendar": {
"conferenceSolution": [{
"onCreateFunction": "createConference",
"id": "1",
"name": "Meeting",
"logoUrl": "https://companyxyz.com/images/logo192.png"
}],
"eventOpenTrigger": {
"runFunction": "buildSimpleCard"
},
"currentEventAccess": "READ_WRITE"
}
}
在Calendar.gs中,下面的代码在那里.
In Calendar.gs, below code is there.
function createConference(e) {
Logger.log(e);
var dataBuilder = ConferenceDataService.newConferenceDataBuilder();
return dataBuilder.build();
}
/**
* Build a simple card with a button that sends a notification.
* This function is called as part of the eventOpenTrigger that builds
* a UI when the user opens a Calendar event.
*
* @param e The event object passed to eventOpenTrigger function.
* @return {Card}
*/
function buildSimpleCard() {
var buttonAction = CardService.newAction()
.setFunctionName('onSaveConferenceOptionsButtonClicked')
.setParameters(
{'phone': "1555123467", 'adminEmail': "joyce@example.com"});
var button = CardService.newTextButton()
.setText('Add new attendee')
.setOnClickAction(buttonAction);
var buttonSet = CardService.newButtonSet()
.addButton(button);
var section = CardService.newCardSection()
.setHeader("addon")
.addWidget(buttonSet);
var card = CardService.newCardBuilder()
.addSection(section)
//.setFixedFooter(footer);
return card.build();
// Check the event object to determine if the user can set
// conference data and disable the button if not.
// if (!e.calendar.capabilities.canSetConferenceData) {
// button.setDisabled(true);
// }
// ...continue creating card sections and widgets, then create a Card
// object to add them to. Return the built Card object.
}
/**
* Callback function for a button action. Sets conference data for the
* Calendar event being edited.
*
* @param {Object} e The action event object.
* @return {CalendarEventActionResponse}
*/
function onSaveConferenceOptionsButtonClicked(e) {
var parameters = e.commonEventObject.parameters;
// Create an entry point and a conference parameter.
var phoneEntryPoint = ConferenceDataService.newEntryPoint()
.setEntryPointType(ConferenceDataService.EntryPointType.PHONE)
.setUri('tel:' + parameters['phone']);
var adminEmailParameter = ConferenceDataService.newConferenceParameter()
.setKey('adminEmail')
.setValue(parameters['adminEmail']);
// Create a conference data object to set to this Calendar event.
var conferenceData = ConferenceDataService.newConferenceDataBuilder()
.addEntryPoint(phoneEntryPoint)
.addConferenceParameter(adminEmailParameter)
.setConferenceSolutionId(1)
.build();
return CardService.newCalendarEventActionResponseBuilder()
.setConferenceData(conferenceData)
.build();
}
我已经从 Publish->从清单中部署中发布了此加载项.
I have published this add-on from Publish->Deploy from menifest.
执行此代码会给我以下错误: ReferenceError:未定义ConferenceDataService .
Executing this code giving me error of ReferenceError: ConferenceDataService is not defined.
我已经搜索了所有可能的参考,但没有找到任何解决方案. 请为我建议适当的解决方案.
I have searched all the possible references, but not able to get any solution. Please suggest me proper solution for this.
推荐答案
According to this comment from this issue here, it looks like there has been a change regarding this.
测试上述代码时,ReferenceError: ConferenceDataService is not defined.
不再显示,并且代码按预期运行.
When testing the above code, the ReferenceError: ConferenceDataService is not defined.
is not displayed anymore and the code runs as expected.
对于特定于ConferenceDataService
的其他方法,您可以在此处查看文档.
For other methods specific to the ConferenceDataService
you can check the documentation here.
- Apps Script ConferenceDataService.
- Cannot create conference with 3rd party Conference Solution from conference solutions Dropdown in Google Calendar
这篇关于ReferenceError:ConferenceDataService未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!