问题标签 [spfx]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
sharepoint - 我们可以使用 SPFx 自定义母版页和页面布局吗?
我正在研究 SharePoint 框架,并且在这方面有一些工作要做。我想知道我们可以使用 SharePoint 框架在 SharePoint Online 中添加我们的自定义母版页和页面布局吗?
如果是,那么你们能否提供一些细节或链接来理解这一点?
我需要使用我的自定义客户端 Web 部件在 SharePoint Online 中部署我自己的自定义母版页和布局。
reactjs - SPFx 如何在列表中设置人员字段,例如“转换”AccountName 为查找 ID?
我正在尝试使用 React Office UI Fabric 构建一个 SPFX WebPart。我有一个 SharePoint 列表,其中包含一个名为 的人员字段AssignedTo
。ID 值如 12、20 等。当我使用 PeoplePicker 选择一个人时,我得到一个AccountName
类似i:0#.f|membership|bob@somewhere.org.nz
的 GUID 和ff53b41e-d11a-435c-9cd1-d708e71ee7c7
.
如何将 PeoplePicker 中的信息“转换”为 ID,列表中的 People 字段正在使用?
PeoplePicker 按如下方式检索人员:
我得到的列表项如下:
任何帮助深表感谢 :-)
javascript - TypeScript/SPFx Promises throws Exception("Cannot read property 'then' of undefined") 但似乎有效
我尝试创建一个 SPFx Webpart。在创建新项目之前,我需要调用 0-4 次,_ensureUser
具体取决于是否设置了Client
、AssignedTo
和的任何组合。当所有需要的调用都完成后,就可以创建新的项目了。ResolvedBy
Referrer
_ensureUser
userPromises[0].then( (value: {}) => { ...
代码在托管工作台上调试时运行,但在我调用或时抛出异常Promise.all(userPromises).then( (value: {}[]) => { ...
。当我单击 F5/继续时,将执行其余部分并创建新项目。_ensureUser
当我直接调用它并将其与 then's 链接时工作,而不是先将它放入 userPromises 数组中。
我认为问题是,它_ensureUser
不会返回一个Promise
. 如果是这样,我该怎么做?我应该重组_ensureUser
和/或createItem
吗?我需要在某个地方调用绑定吗?
createItem
功能:
_ensureUser
功能:
_ensureUser
1 次调用的调试输出:
_ensureUser
2 个调用的调试输出:
typescript - SPFx 如何更新企业关键字列、JSOM、CSOM、REST?
我正在使用 SharePoint Online 并尝试构建 SPFx WebPart。我可以使用 和 检索Enterprise Keywords
存储在我的 InteractionLogListLabel
中GUID
。同样,我可以使用Label
和检索所有分类关键字GUID
。因此,我可以为现有的列表项显示它们。我可以使用TagPicker
. 我无法将这些值存储回列表。
我在Jason Lee 的博客上阅读了使用 REST API、隐藏字段并确保标签中没有空白或列表已损坏。一年多来一直有人要求在 REST 中包含分类法。
在我看来,JSOM 会是一个更好的方法,但我找不到足够的信息来开始。我是整个 SPFx、TypeScript 的新手。我有长期的 C++ 和 C# 编程经验。
knockout.js - 使用 npm 安装淘汰赛时出现错误 - 未满足对等依赖项
我正在使用 node.js 安装淘汰赛,并且正在运行以下命令
但我收到了这些错误。
未满足的对等依赖下划线@^1.8.3
npm WARN knockout-validation@0.1.1 需要下划线@^1.8.3 的对等点,但没有安装。
请帮忙!
npm - 运行命令“npm i”后,我开始收到多个错误
在按照THIS THREADnpm i
运行命令后,我遇到了这个问题。现在,当我尝试为我的项目安装各种依赖项时,我遇到了一堆错误:
λ npm 安装 -g
npm WARN D:\ITC\node_modules\@microsoft\sp-lodash-subset\node_modules\lodash 不是 C:\Users\xxxxx\AppData\Roaming\npm 的子项
npm 错误!路径 D:\ITC\node_modules\@microsoft\sp-lodash-subset\node_modules\lodash
npm 错误!代码ENOENT
npm 错误!错误号 -4058
npm 错误!系统调用重命名
npm 错误!enoent ENOENT:没有这样的文件或目录,重命名 'D:\ITC\node_modules\@microsoft\sp-lodash-subset\node_modules\lodash' -> 'D:\ITC\node_modules\@microsoft\sp-lodash-subset\ node_modules.lodash.DELETE' npm 错误!enoent 这与 npm 找不到文件有关。
npm 错误!恩恩
npm 错误!可以在以下位置找到此运行的完整日志:
npm 错误!
C:\Users\xxxxx\AppData\Roaming\npm-cache_logs\2017-07-26T12_26_10_273Z-debug.log
typescript - SPFx 检索列表项的版本(仅附加注释)
我正在尝试为包含 V3Comments 字段的列表构建一个 SPFx webpart,并设置仅附加评论。据我了解 REST 和 SP-PNP-JS 不支持它。
我读到SharePoint 列表 Web 服务支持GetVersionCollection
. 我以为我看到了一个示例,展示了如何使用SPFx 中的SharePoint 列表 Web 服务。我使用 JSOM 检索分类关键字并使用关键字更新列表项。我可以找到将项目版本作为字符串获取的方法,但不能找到如何实际检索项目的不同版本。我只需要不同版本的 V3Comments 字段。
如何在 V3Comments 字段的 SPFx webpart 中检索版本。JSOM 可以做到吗,或者我如何使用 SPFx 的SharePoint 列表 Web 服务?
microsoft-graph-api - 如何使用 Microsoft Graph API 获取当前站点的 siteId?
从文档中,我找不到任何方法来获取我放置 web 部件的站点的 siteId。
例如,
我当前的站点是:https://{hostname}/sites/main1
<-- 不是根站点,但我想获取这个 siteId
我在这里测试我的webpart:https://{hostname}/sites/main1/_layouts/15/workbench.aspx
我怎样才能做到这一点?从文档中,
站点被寻址为唯一标识符,该标识符是以下值的复合 ID:
网站集主机名 (contoso.sharepoint.com)
网站集唯一 ID (guid)
站点唯一 ID (guid)
我可以通过使用location.hostname
(是的,我正在使用 JavaScript + React 构建我的 webpart)轻松获取主机名,但是如何使用 Graph API 轻松获取站点 ID?
jquery - SPFx can't use JQuery?
I'm working on a brand new SharePoint Web Part using SPFx created by Yeoman, the scaffolding template is fine, adding the NPMs for JQuery and JQueryUI also get not a single problem, I see GULP SERVE running in the background without any errors.
The problem happens when I add the following line inside my JQWebPart.ts:
Once the line above is added the GULP SERVE outputs a very long list of errors, below are the last lines from all the errors:
I have no idea what is going on with my Web Part when I try to use JQuery, does any body have any ideas???
css - How to force Office UI Fabric ChoiceGroup to align horizontal
I am trying to build a SPFx webpart containing a ChoiceGroup. When I set the css style to ms-sm12
the choices are aligned vertical:
I like them to align horizontal in one row:
When I set the style to ms-sm6
, it aligns them "mixed":
The Slider and Toggle are set to ms-sm3
With ms-sm4
it looks like:
With ms-sm3
, ms-sm2
, ms-sm1
it looks like (the title getting more and more squashed and all options in one column:
How can I force / encourage the options to be rendered horizontal?