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,
const items = await list.items
// .select('Id,Title,RoleAssignments/Member/Title,RoleAssignments/RoleDefinitionBindings/*')
.expand('RoleAssignments/Member,RoleAssignments/RoleDefinitionBindings').get();
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