locked
Error : Cannot get value for projected field Approvers_x005f_EMail, how to handle it ? RRS feed

  • Question

  • Hi,

    I have a field Approvers of type People & Group and below is the URL I am using to fetch list items.

    /_api/web/lists/GetByTitle('Request%20Details')/items?$select=Approvers/EMail&$expand=Approvers

    but getting below error :

    

    Which is understandable as EMail property do not exist for a particular item.

    My question is , is their a way to filter out items where EMail property does not exist ? 

    Because of one item, REST does not work at all.

    How we can handle such scenarios using REST ?


    Sandeep Nandey




    Tuesday, June 4, 2019 10:04 AM

All replies

  • Hi Sandeep,

    I understand for some users in your side, there is no Email set for them.

    I did a test with a user which have no email address (no Exchange Online license), in Rest API, this Email property will be exist, but no value:

    _api/web/lists/getbyTitle('DateTest')/items?$select=Approvers/EMail&$expand=Approvers&$filer=Approver/Email

    Would you please details about this specific user who have no email property as by default even there is no email address value, this property will always existed.

    You could get all site users with Email property using this Rest API:

    /_api/web/siteusers

    This will help to identify if the Email property existed for the specific user, if a user has no email box, just has no value but this property existed:

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.



    Wednesday, June 5, 2019 6:39 AM
  • Hi,

    Is there any update of this question ?

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Monday, June 10, 2019 8:58 AM
  • Hi Jerry,

    Thanks for reply.

    As of now, we don't have item without Email property to share as we have removed the item .We had to fix the issue because REST was not working at all.

    But, sometimes because of some issue from AD team, this property for very rare user gets removed or not gets initialized, that's when we face this issue.

    Also, we have faced this issue when we have migrated the content from SP2016 to Online, as some users were not available on Online platform. these field values were automatically updated by some random values ( e.g. Transnational Manager, Anyone )  , which was causing the issue.

    Let me know if you need more details.

    Thanks



    Sandeep Nandey

    Thursday, June 13, 2019 11:35 AM
  • Hi Sandeep,

    If removed the email property perviously for rare users, then suggested to recreate the user in SharePoint Online.

    As in SharePoint Online, the email adress is necessary and regard as user login name. You could delete the issue users and create with the same name as a fix of this issue. And then reassgin user permission and so on...

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Friday, June 14, 2019 9:15 AM
  • The problem is that Microsoft does no fill the EMail field for users without you having a license associated to that user (it started about two years ago and complaining to SharePoint support was a useless wast of time, has always).

    The trick is to assign a license to the user and then remove it and the field will be filled forever.

    Has for the "Cannot get value for projected field " bug I'm still trying to find the solution for other lookups.

    Thursday, August 22, 2019 4:28 PM
  • I was able to fix this by updating "User Information List" items with null EMail field:

                Web AppWebTo = ContextTo.Web;

                List lstTo = AppWebTo.Lists.GetByTitle("User Information List");

                ListItemCollection items = lstTo.GetItems(new CamlQuery() { ViewXml = "<View><Query><Where><IsNull><FieldRef Name='EMail'/></IsNull></Where></Query></View>" });

                ContextTo.Load(items);
                ContextTo.ExecuteQuery();

                foreach(ListItem item in items)
                {
                    if (item["EMail"] == null)
                    {
                        item["EMail"] = "stub@test.com";
                        item.Update();

                        Console.Out.WriteLine((string)item["Title"]);
                    }
                }


                ContextTo.ExecuteQuery();


    Friday, January 24, 2020 5:29 PM