Quantcast
Channel: Developing Apps for SharePoint 2013 forum
Viewing all articles
Browse latest Browse all 8089

Value for properties.ItemEventProperties.ListItemId and ListItem.Id is different for same item

$
0
0
I have one list in App Web. In remote event reciever for item adding event in this list,

properties.ItemEventProperties.ListItemId gives 0 but when I enumerate this list (in another event receiver) ListItem.Id gives 1 for same item.

There only one item in this list, not sure why the values are diffrent:

  CamlQuery query =newCamlQuery();

                query.ViewXml ="<View/>";

               ListItemCollection itemColl = ConfigList.GetItems(query);               

                clientContext.Load(itemColl);

                clientContext.ExecuteQuery();

               foreach (ListItem item in itemColl)

                {

                    if(item.Id == id) //where id isproperties.ItemEventProperties.ListItemId

                    {

                           //some code

                    }

                }

I tried getting the item by below approach but this gives exception:

                ListItem item = ConfigList.GetItemById(id); 

                clientContext.Load(item);

                clientContext.ExecuteQuery();//getting Exception ‘Item does not exists…”

Please help.



Viewing all articles
Browse latest Browse all 8089

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>