My SharePoint buddy has created a new property in a SharePoint Online site for me called IsArchived. I can query that property using this REST API call:

GET https://mycompany.sharepoint.com/sites/mysite/_api/web/allproperties?$select=IsArchived

I get back a JSON response something like:

    "odata.metadata": "https://mycompany.sharepoint.com/sites/mysite/_api/$metadata#SP.ApiData.PropertyValuess/@Element&$select=IsArchived",
    "odata.type": "SP.PropertyValues",
    "odata.id": "https://mycompany.sharepoint.com/sites/mysite/_api/web/allproperties",
    "odata.editLink": "web/allproperties",
    "IsArchived": "Yes"

I was now trying to create/update that property in another SharePoint Online site, with this POST request:

POST https://mycompany.sharepoint.com/sites/myothersite/_api/web




    "IsArchived": false, "__metadata": { "type": "SP.PropertyValues" }

Unfortunately, I only get this response:

    "error": {
        "code": "-1, Microsoft.SharePoint.Client.InvalidClientQueryException",
        "message": {
            "lang": "de-DE",
            // translated to en-US by me
            "value": "The property \"IsArchived\" is not present for type \"SP.Web\". Please ensure to use only property names that are defined in the type."

What exactly is SharePoint trying to tell me here? (I'm not a very extensive SharePoint user or developer - usually, it's a major struggle to get anything from SharePoint ... as seen here, once again ...)

  • Was it created using SharePoint REST API for first site? Commented Mar 11 at 6:52
  • Check this and this and see if it helps. Commented Mar 11 at 6:56
  • @GaneshSanap-MVP: I believe for the first site, my buddy used PowerShell to create that new property and set it to a specific value. But since he mentioned he didn't have to create the property explicitly, before setting its value, I was hoping I could do the same using the REST API from C#
    – marc_s
    Commented Mar 11 at 7:04
  • 1
    Links I shared above suggests that it is not possible using REST API. Maybe you need to use PowerShell or JSOM. I know this can be done easily using Set-PnPPropertyBagValue command in PnP PowerShell. Commented Mar 11 at 7:06


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.