0

I have developed Sharepoint Hosted Addin with a List called Projects. And It has a Lookup for another List called Users to get the Team Lead for that project. When I trying to add new List Item to the Logs list using CRUD APIs and Sharepoint Hosted Addin, It gives this error.

The property 'Lead' does not exist on type 'SP.Data.ProjectsListListItem'. 
Make sure to only use property names that are defined by the type when using 
lookups

I searched lot in there documentations and haven't found a solution. Can anyone help me to go through this error. Thank you.

This is the AJAX call I use to send the data to list,

function addLog(data, formDigest) {
    var url = appUrl + listUrl + "/Items";
    url = GoodT.Repositories.targetUrl(url, hostUrl);

    var call = jQuery.ajax({
        url: url,
        type: "POST",
        data: data,
        headers: {
            Accept: "application/json;odata=verbose",
            "Content-Type": "application/json;odata=verbose",
            "X-RequestDigest": formDigest
        }
    });

    return call;
}
  • can you share the sample code/ code snippet that you are using ? – Gautam Sheth Oct 30 '18 at 6:53
  • @Sandun Make sure list identity name is correcnt i.e. SP.Data.ProjectsListListItem which can be verify by /_api/Web/Lists/getbytitle('List Name')/ListItemEntityTypeFullName – Shridhar J Joshi Oct 30 '18 at 6:59
  • Yeh, It's correct. But I have given this error. @ShridharJJoshi – Sandun Isuru Niraj Oct 30 '18 at 7:47
  • I have tried changing the Listnames also. But didn't worked. This is worked fine before I delete my List accidentally. – Sandun Isuru Niraj Oct 30 '18 at 7:49
  • @sandun lead is internal name? – Shridhar J Joshi Oct 30 '18 at 7:58
0

If the "Lead" is the single lookup/user field, the data structure like this.

var data = {
    '__metadata': { "type": "SP.Data.ProjectsListItem" },
    "Title": 'Test',
    'LeadId': 12  //single-valued User field value 
};

If the "Lead" is the multiple lookup/user field, the data structure like this.

var data = {
    '__metadata': { "type": "SP.Data.ProjectsListItem" },
    "Title": 'Test',
    'LeadId': {"results": [12] }  //multi-valued User field value 
};
| improve this answer | |
  • Oh Thanks a Lot, This worked for me. Because I have entered values for Leader, not the LeaderId. You have saved my 2 days. – Sandun Isuru Niraj Oct 31 '18 at 4:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.