Pnpjs: Update only works with { Title: string; Description: string; }

Created on 21 Feb 2020  路  2Comments  路  Source: pnp/pnpjs

Category

  • [ ] Enhancement
  • [X ] Bug
  • [ X] Question
  • [ X] Documentation gap/issue

Version

Please specify what version of the library you are using: [ 2.0.3 ]

Please specify what version(s) of SharePoint you are targeting: [ SOP ]

Expected / Desired Behavior / Question

the code
const updateLinkingUri = async (fileLink,itemId) => { const appWeb = Web(window.location.origin + "/sites/app/"); let list = appWeb.lists.getByTitle("ECG-Document-Number-Master"); const iu:IItemUpdateResult = await list.items(itemId).update({ "LinkingUri": fileLink }); };
Should work with no tslint issues the list "ECG-Document-Number-Master" has a text field named "LinkingUri"

Observed Behavior

Linter errors:
Argument of type '{ "LinkingUri": any; }' is not assignable to parameter of type '{ Title: string; Description: string; }'. Object literal may only specify known properties, and '"LinkingUri"' does not exist in type '{ Title: string; Description: string; }'.ts(2345)

Steps to Reproduce

create function as describe.

Thanks for the help

code answered not a bug question

All 2 comments

Hi @Ofer-Gal,

You probably have an issue within that line list.items(itemId).update. As it should be list.items.getById(itemId).update instead.

Wow you are quick :-)
I just realized my mistake
Thanks

Was this page helpful?
0 / 5 - 0 ratings