Repository for the PnP JavaScript Core component development together with community members
Continuing with my last message. An example of a request made by a contributor (not edit or full control permissions) would be this one, he is capable of updating MyStatus which is the readonly field:
var reqUrl= "https://XXXXXX.sharepoint.com/sites/XXXXXX/_api/web/lists/getByTitle('MyItems')/items(7)/ValidateUpdateListItem";
var body= {"formValues":[{"FieldName":"MyStatus","FieldValue":"Whatever"}],bNewDocumentUpdate:false}
var _payloadOptions = {
method: "POST",
body: undefined,
headers: {
credentials: "include",
Accept: "application/json; odata=verbose",
"Content-Type": "application/json; odata=verbose"
}
};
fetch("https://XXXXXX.sharepoint.com/sites/XXXXXX/_api/contextinfo",_payloadOptions).then(r=>r.json())
.then(r=>
_payloadOptions.headers["X-RequestDigest"]=r.d.GetContextWebInformation.FormDigestValue
_payloadOptions.body=JSON.stringify(body);
fetch(reqUrl
,_payloadOptions).then(r=>r.json()).then(r=>console.log(r))
})
sp
and web
, and if someone calls pnp.sp.web
instead of pnp.web
it would point at the wrong web, but when using .configure
it will still work. (My pnp.web
is based on Web(url)
)
.setup
outside of everything, as it doesn't matter when/how it is done
"RoleAssignments": {
"__deferred": {
"uri": "<sharepoint_url>/_api/Web/Lists(guid'9af2ab3e-3a61-49a5-bd25-492ea7191b43')/Items(31)/RoleAssignments"
}
},
"FileSystemObjectType": 0,
"Id": 31,
"ServerRedirectedEmbedUrl": "",
"Dependency": false,
Current_x0020_status_x0020_works
(yes, so x0020 is encoding for a space). Is there any way of getting the property back as either "Current_status_works" or "CurrentStatusWorks" ?
Is there any way of getting the property back as either "Current_status_works" or "CurrentStatusWorks" ?
Only if a field is originally created/provisioned with a Dev-friendly internal name.
In the UI, it can be done by creating a field without using disallowed symbols when then a field is created renaming its display name to whatever a user should see in the UI.
Or creating a field with code. PnP Provisioning Engine does this job well.
_vti_bin/ListData.svc
and similar
so, if I have this code
const result = await sp.web.lists.getByTitle(title)();
console.log(result);
I get this result
[snip}
FileSavePostProcessingEnabled: false,
ForceCheckout: false,
HasExternalDataSource: false,
Hidden: false,
Id: 'dec72266-3364-4337-94eb-c6237d8dddca',
ImagePath: {
__metadata: { type: 'SP.ResourcePath' },
DecodedUrl: '/_layouts/15/images/itgantt.png?rev=43'
},
ImageUrl: '/_layouts/15/images/itgantt.png?rev=43',
IrmEnabled: false,
IrmExpire: false,
IrmReject: false,
IsApplicationList: false,
IsCatalog: false,
IsPrivate: false,
ItemCount: 2032,
LastItemDeletedDate: '2020-11-26T08:48:38Z',
LastItemModifiedDate: '2020-11-26T10:50:47Z',
LastItemUserModifiedDate: '2020-11-26T08:51:26Z',
[snip}
the Id
field definitely starts with a "dec" ..