SPFx pnpjs在通讯站点上插入新列表项失败

时间:2018-06-09 13:28:40

标签: sharepoint-online spfx

我正在使用@ pnpjs / sp最新版本创建SharePoint Framework解决方案。我正在使用以下代码将新项目添加到列表中:

public registerParticipant(currentUserId: number, sessionId: number, eventId: number, eventTitle: string): ItemAddResult {
        let ready: ItemAddResult = null;
        sp.web.lists.getByTitle("Event Participants").items.add({
          ParticipantId: currentUserId,
          EventSessionIdId: sessionId,
          EventId: eventId,
          Event_x003a_TitleId: eventId,
          Title: eventTitle
        }).then(result => {
        ready = result;
      });
      return ready;
    }

使用工作台,代码在调试模式下工作正常,但是当我执行部署的Web部件时,我得到了这个:

  

SyntaxError:e.registerParticipant的输入意外结束   (https://publiccdn.sharepointonline.com/novartis280.sharepoint.com/sites/appcatalog/ClientSideAssets/f1b27af2-e3d4-4d69-a0f6-88abc63495f1/event-register-demo-1-web-part_6b19cb10fb6ee41e2c05f9ac542ac5b9.js:33:341743)↵   在   https://publiccdn.sharepointonline.com/novartis280.sharepoint.com/sites/appcatalog/ClientSideAssets/f1b27af2-e3d4-4d69-a0f6-88abc63495f1/event-register-demo-1-web-part_6b19cb10fb6ee41e2c05f9ac542ac5b9.js:33:318786

“then”功能发生错误。为什么它会在调试中工作,而不是在生产中的发布模式下工作?

该应用程序已经在一个经典网站上工作了几个月,但是当我将它移动到通信站点时,它停止了上述错误。

0 个答案:

没有答案
相关问题